[issue26988] Add AutoNumberedEnum to stdlib
Barry A. Warsaw
report at bugs.python.org
Fri Aug 19 10:45:17 EDT 2016
Barry A. Warsaw added the comment:
Hey, I just realized that you can get pretty darn close with just a little bit
of extra typing, and existing stdlib:
from enum import Enum
from itertools import count
auto = count()
class Color(Enum):
red = next(auto)
green = next(auto)
blue = next(auto)
Look ma, no magic!
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26988>
_______________________________________
More information about the Python-bugs-list
mailing list