Closed
Description
Bug report
class Example1:
str: str = 'text'
Example1.__annotations__
>>> {'str': 'text'}
class Example2:
attr1: str = 'text'
int: int = 5
str: str = 'some str'
attr2: int = 150
Example2.__annotations__
{'attr1': <class 'str'>, 'int': 5, 'str': 'some str', 'attr2': 5}
I understand that using such names for attributes is not the best idea, but still the behavior with rewrites is strange.
It is also strange that I did not found anything similar in existing issues, because I have been observed that behavior for a long time..
Environment
- CPython versions tested on: 3.8.10, 3.9.13, 3.10.4, 3.11.0
- OS: Windows 10 x64