[Python-ideas] Enums

Chris Rebert pyideas at rebertia.com
Mon Jul 25 08:32:19 CEST 2011


On Sun, Jul 24, 2011 at 11:04 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Ben Finney, 25.07.2011 04:09:
>> Guido van Rossum writes:
>>
>>> For enums, I think we should just pick a solution. I'm in favor of
>>> Barry Warsaw's version, flufl.enum.
>>
>> As the maintainer of the PyPI ‘enum’ package, I also support the FLUFL's
>> ‘flufl.enum’ to be the One Obvious Way.
>
> Never used enums in Python, and likely won't do so anywhere in the near
> future, but I just read through the usage page at
>
> http://packages.python.org/flufl.enum/docs/using.html
>
> and *if* such a library gets added to the stdlib, then this is the way it
> should work. The examples totally make sense to me.

My only nitpicks would be:
- Why violate TOOWTDI by having both SomeEnum(...) and SomeEnum[...]
that do the same thing?
- Why is it .enumname and not simply .name? .enumname could also be
confused as getting the name of the overarching enum rather than the
name of the particular enum value.

Cheers,
Chris



More information about the Python-ideas mailing list