This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients eric.smith, gvanrossum, kj, xirdneh
Date 2021-02-20.01:18:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613783932.6.0.423851458811.issue43257@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-02-20 01:18:52gvanrossumsetrecipients: + gvanrossum, eric.smith, kj, xirdneh
2021-02-20 01:18:52gvanrossumsetmessageid: <1613783932.6.0.423851458811.issue43257@roundup.psfhosted.org>
2021-02-20 01:18:52gvanrossumlinkissue43257 messages
2021-02-20 01:18:52gvanrossumcreate