Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
No, List[42] is not currently accepted. >>> List[42] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/serhiy/py/cpython/Lib/typing.py", line 318, in inner return func(*args, **kwds) ^^^^^^^^^^^^^^^^^^^ File "/home/serhiy/py/cpython/Lib/typing.py", line 1127, in __getitem__ params = tuple(_type_check(p, msg) for p in params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/serhiy/py/cpython/Lib/typing.py", line 1127, in <genexpr> params = tuple(_type_check(p, msg) for p in params) ^^^^^^^^^^^^^^^^^^^ File "/home/serhiy/py/cpython/Lib/typing.py", line 184, in _type_check raise TypeError(f"{msg} Got {arg!r:.100}.") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: Parameters to generic types must be types. Got 42. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46644> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com