[Python-ideas] PEP for enum library type?

Eli Bendersky eliben at gmail.com
Tue Feb 12 23:13:57 CET 2013


On Tue, Feb 12, 2013 at 1:04 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Tue, 12 Feb 2013 12:58:44 -0800
> Eli Bendersky <eliben at gmail.com> wrote:
>
> > On Tue, Feb 12, 2013 at 11:59 AM, Guido van Rossum <guido at python.org>
> wrote:
> >
> > > After all the defenses I still don't like Tim's proposed syntax. Color
> me
> > > Barry.
> > >
> >
> > In this case, I see no reason not to use Barry's flufl.enum - it's pretty
> > good and has been around for a while. The main advantage of Tim's
> > implementation syntax (wasn't it Michael Foord who originally proposed
> it?)
> > is that it lets us do less typing which is great. IOW, sure with
> flufl.enum
> > I can do this and be reasonably happy:
> >
> > class Color(Enum):
> >   RED = 1
> >   BLUE = 2
> >   GREEN = 3
>
> I still hope enum values are strings by default - or, if not, that they
> get nice reprs. Integer enums are only useful for interoperability with
> stubborn low-level libraries :-)
>

I agree, and Tim's implementation provides a very nice string
representation, no matter what the value underneath is. I don't really care
what the value underneath is, actually.

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


More information about the Python-ideas mailing list