-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Implement PEP 647 (User-Defined Type Guards) in typing.py #87932
Comments
PEP-647 was recently accepted by the SC: I'd like to work on the implementation for typing.py and any required docs later on (unless someone is already working on it, then I hope you'd let me help too ;). Hopefully I can get it in before the 3.10 beta freeze. typing_extensions will need a port too, though that is much less urgent at the moment. |
Go for it! I assume that this will be pretty simple, right? TypeGuard[X] should show up in __annotations__ as exactly that. It can be implemented in pure Python. |
Yep! The PR speaks for itself ;). typing.py has pretty nice internal constructs to make these types of additions a breeze. I'm really grateful to whoever wrote/refactored the _SpecialForm decorator to what it is today. |
Guido, thanks so much for reviewing the docs for TypeGuard so thoroughly even with how busy you are. I hope you enjoy your upcoming vacation :). I'm closing this issue as all PRs have landed. Please don't hesitate to re-open this if you feel something's amiss. Thanks! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: