[Python-ideas] PEP for enum library type?

Antoine Pitrou solipsis at pitrou.net
Wed Feb 13 08:21:29 CET 2013


On Wed, 13 Feb 2013 00:57:38 +0100
Georg Brandl <g.brandl at gmx.net> wrote:
> > IMHO, none of these approach the simplicity and explicitness of this API:
> > 
> > class Color(Enum):
> >     RED = 1
> >     GREEN = 2
> >     BLUE = 3
> 
> We could even allow
> 
> class Color(Enum):
>     RED = 1
>     GREEN = ...       # becomes 2
>     BLUE = ...        # 3
>     MAGENTA = 5
>     FLUFL = ...       # 6

The fact that the ellipsis variant requires *more* typing sounds a bit
wrong to me. The common case should be the easiest to type.

Regards

Antoine.





More information about the Python-ideas mailing list