Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
It does not have a use case of T[int] in mind. It is an implementation detail which simplifies the code, makes runtime checks more strict and makes types.GenericAlias more similar to typing._GenericAlias. For example, currently: >>> A = List[T] >>> B = list[T] >>> A[None] typing.List[NoneType] >>> B[None] list[None] >>> A['X'] typing.List[ForwardRef('X')] >>> B['X'] list['X'] With the proposed change: >>> B[None] list[NoneType] >>> B['X'] list[ForwardRef('X')] Meanless expressions like A[42], A[Final], A[Final[int]], A[ClassVar], A[ClassVar[int]], etc which are silently accepted will now be errors. The code simplification (especially for the C code) is my primary goal, and the rest is a nice side effect. It is possible to add more strict runtime checks and conversions without making TypeVar and ParamSpec subscriptable, but the code will not be so simple. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44796> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com