[Python-ideas] PEP for enum library type?

Eli Bendersky eliben at gmail.com
Tue Feb 12 16:21:04 CET 2013


Hi all,

The ideas thrown around and Tim's prototype in the thread "constant/enum
type in stdlib" show that it's possible to use some metaclass magic to
implement very convenient syntax for enums, while only including them in
the stdlib (no language changes):

from enum import Enum

class Color(Enum):
  RED, BLUE, GREEN

I'm, for one, convinced that with this in hand we should *not* add special
syntax for enums, since the gains would be minimal over the above proposal.

While the parallel thread (and Tim's Bitbucket issue tracker) discusses his
proposed implementation, I think it may be worthwhile to start from the
other direction by writing a PEP that aims to include this in 3.4. The way
I see it, the PEP should discuss and help us settle upon a minimal set of
features deemed important in an enum.

If that sounds OK to people, then someone should write that PEP :-) This
could be Tim, or Barry who's been maintaining flufl.enum for a long time.
If no one steps up, I will gladly do it.

Thoughts?

Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130212/38674503/attachment.html>


More information about the Python-ideas mailing list