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
Is it still necessary to prohibit generics at runtime? #303
You cannot use the subscripted class (e.g. ``Node[int]``) directly in
an expression -- you must define a type alias. (This restriction
exists because creating the subscripted class, e.g. ``Node[int]``, is
an expensive operation -- usually many times as expensive as
constructing an instance of it. Using a type alias is also more
readable.)
However, __getitem__ is cached for generics now and this leads to significant speedup (Guido reported up to 300x speedup in extreme cases). I think the above restriction is not necessary anymore and could be removed from the PEP.
Activity
gvanrossum commentedon Oct 18, 2016
However mypy still prohibits it. I'd much rather remove this from mypy and leave it in the PEP than the other way around. ;-)
Allow generics in runtime expressions (#2302)
Soften restriction for runtime generics in PEP 484 (#120)
Allow generics in runtime expressions (python#2302)