[issue2502] Add enum() example for named tuples
Amaury Forgeot d'Arc
report at bugs.python.org
Fri Mar 28 14:05:28 CET 2008
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
Raymond, is this kind of recipes worth adding to the 'collections' module?
Maybe with the following form:
def enum(*valuenames):
return namedtuple('Enum', valuenames)(*range(len(valuenames)))
----------
nosy: +amaury.forgeotdarc, rhettinger
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2502>
__________________________________
More information about the Python-bugs-list
mailing list