Guido van Rossum <gu...@python.org> 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 <rep...@bugs.python.org>
<https://bugs.python.org/issue43257>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to