[issue44524] __name__ attribute in typing module

Serhiy Storchaka report at bugs.python.org
Thu Aug 19 12:36:15 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

There are some side effects of setting _name. In 3.9:

>>> class X(Annotated[int, (1, 10)]): pass
... 
>>> X.__mro__
(<class '__main__.X'>, <class 'int'>, <class 'object'>)

In 3.10:

>>> class X(Annotated[int, (1, 10)]): pass
... 
>>> X.__mro__
(<class '__main__.X'>, <class 'int'>, <class 'typing.Generic'>, <class 'object'>)

Now a subclass of an Annotated alias is a generic type. Should it be?

----------

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


More information about the Python-bugs-list mailing list