Ethan Furman <et...@stoneleaf.us> added the comment:

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! :-)

----------
assignee:  -> ethan.furman
stage:  -> needs patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43162>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to