[issue44578] dict with more than two type parameters doesn't raise a TypeError

Michael report at bugs.python.org
Wed Jul 7 09:26:23 EDT 2021


Michael <login at michaelthe.com> added the comment:

Same for list btw

Python 3.9.6 (default, Jul  7 2021, 11:41:04) 
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> list[str, str, str]
list[str, str, str]
>>> from typing import List
>>> List[str, str, str]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/michaelthe/.pyenv/versions/3.9.6/lib/python3.9/typing.py", line 275, in inner
    return func(*args, **kwds)
  File "/Users/michaelthe/.pyenv/versions/3.9.6/lib/python3.9/typing.py", line 828, in __getitem__
    _check_generic(self, params, self._nparams)
  File "/Users/michaelthe/.pyenv/versions/3.9.6/lib/python3.9/typing.py", line 212, in _check_generic
    raise TypeError(f"Too {'many' if alen > elen else 'few'} parameters for {cls};"
TypeError: Too many parameters for typing.List; actual 3, expected 1
>>>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44578>
_______________________________________


More information about the Python-bugs-list mailing list