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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4