Guido van Rossum <[email protected]> added the comment:
Oops, I realized it's not really a compiler bug. When the compiler sees
class C:
str: str = "abc"
if effectively rearranges that to
class C:
str = "abc"
__annotations__["str"] = str
(where __annotations__ is initialized to {} at the start of the class scope).
This goes to prove once again that silly things like
str: str
are an anti-pattern and should not be used.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43257>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com