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 eli.bendersky
Recipients barry, eli.bendersky, ethan.furman
Date 2013-09-04.21:08:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAF-Rda8wHBSJo5Z_0sZ70dcEatKiOhH_EMuQTmngC3EXpesvHA@mail.gmail.com>
In-reply-to <52279EC2.8000205@stoneleaf.us>
Content
On Wed, Sep 4, 2013 at 1:57 PM, Ethan Furman <report@bugs.python.org> wrote:

>
> 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/.
>

I can empathize with your reasoning, but I'm still -1. There's an infinite
amount of tweaks you can think of to make Enum "safer", in a language that
by design is unsafe for such operations. You will keep finding new holes,
because the language will keep fighting you. And the end result? A bit more
theoretical purity, hardly any tangible gain. But more complex code, which
makes it more prone to bugs and more difficult to understand.
History
Date User Action Args
2013-09-04 21:08:14eli.benderskysetrecipients: + eli.bendersky, barry, ethan.furman
2013-09-04 21:08:14eli.benderskylinkissue18924 messages
2013-09-04 21:08:14eli.benderskycreate