[issue18924] Enum members are easily replaced

Ethan Furman report at bugs.python.org
Wed Sep 4 22:57:37 CEST 2013


Ethan Furman added the comment:

Eli Bendersky added the comment:
>
> So let's stop trying to make enums even more alien. This is a non-issue in Python.

Enumerations are supposed to be constant.  Since this is Python there is actually very little that cannot be changed, 
but we can make objects better reflect our intent.

For Enum members Guido had me change the `value` and `name` attributes to properties because the value and name should 
also be constant.  Can they still be changed?  Yes, but you have to know what you're doing.  (Enum.member._name_ = ... )

I'm proposing we do the same thing for the Enum class that we did for the Enum member.

To me, an Enumeration that lets you change its constants higgledy-piggledy is way more alien than one that tries to 
stay, um, /constant/.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18924>
_______________________________________


More information about the Python-bugs-list mailing list