Message380801
Python 3.7-3.10a1:
```
>>> List.__name__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/typing.py", line 760, in __getattr__
raise AttributeError(attr)
AttributeError: __name__
>>> type(List)
<class 'typing._SpecialGenericAlias'>
>>> type(List[int])
<class 'typing._GenericAlias'>
```
Python 3.6:
```
>>> from typing import List
>>> List.__name__
'List'
>>> type(List)
<class 'typing.GenericMeta'>
>>> type(List[int])
<class 'typing.GenericMeta'>
```
Is this lack of common meta attributes intentional? It makes the typing types unusual.
We just saw it trip up some code that was expecting everything to have a `__name__` attribute while moving beyond 3.6. Judging by that `__getattr__` implementation it should happen on other common `__` attributes as mentioned in https://docs.python.org/3/library/stdtypes.html?highlight=__name__#special-attributes as well. |
|
Date |
User |
Action |
Args |
2020-11-12 02:23:04 | gregory.p.smith | set | recipients:
+ gregory.p.smith |
2020-11-12 02:23:03 | gregory.p.smith | set | messageid: <1605147783.95.0.972217346071.issue42329@roundup.psfhosted.org> |
2020-11-12 02:23:03 | gregory.p.smith | link | issue42329 messages |
2020-11-12 02:23:03 | gregory.p.smith | create | |
|