[issue41780] Generic Alias attributes nor in dir()

Batuhan Taskaya report at bugs.python.org
Tue Sep 15 10:19:52 EDT 2020


Batuhan Taskaya <isidentical at gmail.com> added the comment:

Okay, so IIRC if we stop forwarding __class__ (add it as an exception to attr_exceptions) it would return us the original dir(), and also solve the inconsistency of the example you gave;

> >>> list.__class__
> <class 'type'>
> >>> list[int].__class__
> <class 'type'>
>
> >>> type(list)
> <class 'type'>
> >>> type(list[int])
> <class 'types.GenericAlias'>

but the problem is that, it is not 'exactly' complying with the specs at PEP 585. I am aware that we already added some extras to this list (https://www.python.org/dev/peps/pep-0585/#parameters-to-generics-are-available-at-runtime) like __mro_entries__ etc, but __class__ looks like a tricky problem. @gvanrossum any comments?

----------

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


More information about the Python-bugs-list mailing list