Ken Jin <kenjin4...@gmail.com> added the comment:

Sorry, I don't think this will be fixed as it is intentional. 
types.GenericAlias (the type of list[int] or dict[str, str]) does almost 0 
checking for two reasons IIUC:

- Types with wrong number of parameters will usually be caught by your IDE/type 
checker.
- Checking would add complexity and slow down runtime performance. The current 
implementation of GenericAlias in C is intentionally simple.

We can add a note in the docs noting that too many type parameters won't raise 
a TypeError. It would probably be here 
https://docs.python.org/3/library/stdtypes.html#generic-alias-type

BTW, I adjusted the issue's affected versions because this was introduced only 
in 3.9.

----------
nosy: +gvanrossum, kj
versions: +Python 3.10, Python 3.11 -Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44578>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to