
Jan. 23, 2008
1:16 p.m.
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:
enum = Enum("error=-1", "ok", "also_ok", "someother=1000", "last") enum.error -1 enum.ok 0 enum.also_ok 1 enum.someother 1000 enum.last 1001
Christian