Mark Summerfield wrote:
There is an enum module in PyPI
http://pypi.python.org/pypi/enum/
and there are several versions in the Python Cookbook.
Wouldn't one of these be worth adopting for the standard library?
It might be worth adding an enum to Python 2.6. I'm +0 on it.
The enum implementation from pypi is not sufficient for Python core. I
don't like its __cmp__ and __hash__ code. I also miss the feature to set
a start value or to skip values:
I'd be +1 on adding an enum type. I chose an enum type from the
cookbook for our company to use. All was great until 1-2 years later
when we needed to start persisting objects that contained enums. We
found that that publically available enums wouldn't cope and we had to
invest signficant effort in changing our code. E.g. the enum type from
pypi: