[issue17961] Use enum names as values in enum.Enum convenience API

Barry A. Warsaw report at bugs.python.org
Mon May 13 00:00:29 CEST 2013


Barry A. Warsaw added the comment:

On May 12, 2013, at 10:57 AM, Nick Coghlan wrote:

>I encountered an interesting suggestion [1] regarding the enum.Enum
>convenience API: use the member names as their values, rather than the
>current integers starting from one.
>
>Since we're now using definition order rather than value order for iteration,
>this suggestion makes a lot of sense to me.

Cute, but I want the functional API to be equivalent to the class syntax.

Besides:

X = Enum('X', ((name, name) for name in 'ant bee cat dog elk'.split()))

is not so much typing.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17961>
_______________________________________


More information about the Python-bugs-list mailing list