On Mon, Jun 10, 2019 at 02:29:56PM -0700, Ethan Furman wrote: > Greetings! > > I saw my first annotation mix-up with regards to Enum today: [...]
I don't think this is particular to Enums. I think this is going to be a stumbling block for any class. py> class X: ... a: 1 ... b: 2 ... py> X.__annotations__ {'a': 1, 'b': 2} py> X.a Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: type object 'X' has no attribute 'a' Even after 20 years, I occassionally mix up a:1 and a=1 syntax in dicts. It doesn't matter there, because its a syntax error. If I wrote more class attributes, I'd probably make this error occassionally too. I think this is going to especially bite beginners, who tend to write more class attributes. (Especially those coming from other languages, where instance attributes are declared at class level.) -- Steven _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/B43WEQFL5HVRT6KS5TKSNFEKUWYX4DEB/