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
Backport generic NamedTuple and TypedDict support #7
Python 3.11 will support generic NamedTuples (python/cpython#92027) and TypedDicts (python/cpython#27663) at runtime. If there is community interest, we should backport support for these features into typing-extensions. I'm not planning to work on this myself but I'll accept patches.
I'd be interested in working on this if nobody else wants to, but I've got quite a lot on for the next two weeks or so, so I'm happy to let somebody else tackle it if they can do it more promptly!
Reacted by Jelle Zijlstra, Thomas Grainger, 93578237, Mehdi Drissi, Ozair Patel, Ken Jin and Thomas M Kehrenberg
As discovered in Python Discord's #type-hinting channel (09/05/2022), typing_extensions 4.2 release appears to support this already.
That said, it appears to still be missing for Python 3.7 and 3.8. This CI run of mine is on Python 3.7 and locally I can reproduce it on my Python 3.8.10 installaton (py -3.8-64 -c "import discord_typings"):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\%username%\Projects\discord-typings\discord_typings\__init__.py", line 5, in <module>
from .gateway import *
File "C:\Users\%username%\Projects\discord-typings\discord_typings\gateway.py", line 267, in <module>
ReadyEvent = GenericDispatchEvent[Literal['READY'], ReadyData]
TypeError: '_TypedDictMeta' object is not subscriptable
Activity
AlexWaygood commentedon May 3, 2022
I'd be interested in working on this if nobody else wants to, but I've got quite a lot on for the next two weeks or so, so I'm happy to let somebody else tackle it if they can do it more promptly!
Bluenix2 commentedon May 14, 2022
As discovered in Python Discord's
#type-hintingchannel (09/05/2022), typing_extensions 4.2 release appears to support this already.That said, it appears to still be missing for Python 3.7 and 3.8. This CI run of mine is on Python 3.7 and locally I can reproduce it on my Python 3.8.10 installaton (
py -3.8-64 -c "import discord_typings"):JelleZijlstra commentedon May 16, 2022
The current support is accidental, not tested, and doesn't cover all supported Python versions, so I don't think it really makes a difference.
Bluenix2 commentedon May 16, 2022
It gives hints as to what one could do to make this pass on all versions ☝️
julien-blanchon commentedon Jun 7, 2023
I love this ! I hope TypedDict will also be include soon. Thanks you @JelleZijlstra @AlexWaygood