At 11:31 AM 11/23/2010 -0500, Barry Warsaw wrote:
On Nov 23, 2010, at 03:15 PM, Michael Foord wrote:
>(Well, there is a third option that takes __name__ and sets the constants in
>the module automagically. I can understand why people would dislike that
>though.)
Personally, I think if you want that, then the explicit class definition is a
better way to go.
This reminds me: a stdlib enum should support proper pickling and
copying; i.e.:
assert SomeEnum.anEnum is pickle.loads(pickle.dumps(SomeEnum.anEnum))
This could probably be implemented by adding something like:
def __reduce__(self):
return getattr, (self._class, self._enumname)
in the EnumValue class.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com