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 ethan.furman
Recipients ethan.furman, hroncok
Date 2021-02-08.18:32:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612809178.68.0.85044959806.issue43162@roundup.psfhosted.org>
In-reply-to
Content
The code for that `__str__` seems very inefficient -- why doesn't it just do:

    return self.name

?

-----

The issue is not being able to access class attributes, the issue is whether one enum member should be seen as an attribute of another:

  EnumClass.RED.BLUE

and the answer is no.  That wasn't possible when Enum was first introduced in 3.4, and was an unfortunate side-effect of speeding up member access in 3.5 (or 3.6).  The docs have always warned against it.

A deprecation warning is an easier transition, though, so I'll do that for 3.10, and in 3.11 it will become an error.

Thank you for reporting! :-)
History
Date User Action Args
2021-02-08 18:32:58ethan.furmansetrecipients: + ethan.furman, hroncok
2021-02-08 18:32:58ethan.furmansetmessageid: <1612809178.68.0.85044959806.issue43162@roundup.psfhosted.org>
2021-02-08 18:32:58ethan.furmanlinkissue43162 messages
2021-02-08 18:32:58ethan.furmancreate