You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement PEP 647 (User-Defined Type Guards) in typing.py #87932
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:
assignee=Noneclosed_at=<Date2021-04-27.15:59:43.758>created_at=<Date2021-04-07.14:27:50.266>labels= ['library', '3.10']
title='Implement PEP 647 (User-Defined Type Guards) in typing.py'updated_at=<Date2021-04-27.15:59:43.757>user='https://github.com/Fidget-Spinner'
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.
Activity
Fidget-Spinner commentedon Apr 7, 2021
PEP-647 was recently accepted by the SC:
https://mail.python.org/archives/list/[email protected]/thread/2ME6F6YUVKHOQYKSHTVQQU5WD4CVAZU4/
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.
gvanrossum commentedon Apr 7, 2021
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.
Fidget-Spinner commentedon Apr 8, 2021
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.
gvanrossum commentedon Apr 27, 2021
New changeset 05ab4b6 by Ken Jin in branch 'master':
bpo-43766: Implement PEP-647 (User-Defined Type Guards) in typing.py (bpo-25282)
05ab4b6
gvanrossum commentedon Apr 27, 2021
New changeset 99fdd78 by Ken Jin in branch 'master':
bpo-43766: Fix TypeGuard docs (bpo-25660)
99fdd78
Fidget-Spinner commentedon Apr 27, 2021
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!