[Python-ideas] PEP for enum library type?

Tim Delaney timothy.c.delaney at gmail.com
Tue Feb 12 22:19:41 CET 2013


On 13 February 2013 07:58, Eli Bendersky <eliben at gmail.com> wrote:

>
> But in 99% of the cases in Python code I absolutely don't care about the
> values of these enumerations (*), so I'd much, *much* rather write:
>
> class Color(Enum):
>   RED, BLUE, GREEN
>
> Yes, the implementation is messy, but it can be documented and tested
> well, and it's fairly small and confined. But this is a matter of
> preference, and I can see your point (Guido) about preferring the more
> explicit syntax in order to avoid too much magic.
>
> Eli
>
> (*) And where I do care, I'd still enjoy them being generated
> automatically.
>

I'm of the opinion that the most fundamental property of an enum is that it
can generate its values automatically. Everything else is a nice-to-have,
but without that property it's not much use as an enum.

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130213/23a58b82/attachment.html>


More information about the Python-ideas mailing list