[Python-ideas] PEP for enum library type?

Antoine Pitrou solipsis at pitrou.net
Tue Feb 12 22:04:12 CET 2013


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 :-)

Regards

Antoine.





More information about the Python-ideas mailing list