Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write union types as X | Y (PEP 604) #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Write union types as X | Y (PEP 604) #51

wants to merge 1 commit into from

Conversation

twmr
Copy link
Owner

@twmr twmr commented Sep 8, 2022

No description provided.

@tony
Copy link
Contributor

tony commented Sep 9, 2022

Friendlier typing syntax seems to be a carrot for deprecating old python releases.

In my tmuxp project, I still support python 3.7, so have to use Union, Optional, etc.

In my libvcs project, it's python 3.9+, I can use str | None instead of Optional[None] and int | str instead of Union[int, str]. It's so much cleaner.

@twmr
Copy link
Owner Author

twmr commented Sep 13, 2022

At work we are also using python3.7 and thx to the __future__ import we can use e.g. the PEP604 type annotations, but I was not aware that this doesn't work at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants