[Python-Dev] constant/enum type in stdlib (original) (raw)
Barry Warsaw barry at python.org
Tue Nov 23 21:01:02 CET 2010
- Previous message: [Python-Dev] constant/enum type in stdlib
- Next message: [Python-Dev] constant/enum type in stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Nov 23, 2010, at 11:52 AM, P.J. Eby wrote:
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.
Excellent idea, thanks. Added to flufl.enum in r38. However, only enums created with the class syntax can be pickled though.
Cheers, -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-dev/attachments/20101123/4ebdef12/attachment.pgp>
- Previous message: [Python-Dev] constant/enum type in stdlib
- Next message: [Python-Dev] constant/enum type in stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]