A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-November/105898.html below:

[Python-Dev] constant/enum type in stdlib

[Python-Dev] constant/enum type in stdlib [Python-Dev] constant/enum type in stdlibP.J. Eby pje at telecommunity.com
Tue Nov 23 17:52:37 CET 2010
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.

More information about the Python-Dev mailing list

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