[Python-Dev] PyPy, Jython, & IronPython: Enum convenience function and pickleablity

Barry Warsaw barry at python.org
Fri May 3 02:01:54 CEST 2013


On May 03, 2013, at 09:14 AM, Nick Coghlan wrote:

>> The other issue is your proposal to have a class-based convenience syntax
>akin to (correct me if I got this wrong):
>>
>> class Animal(Enum):
>>   __values__ = 'cat dog'
>
>I would suggest moving the field names into the class header for a class
>based convenience API:
>
>class Animal(Enum, members='cat dog'): pass

Wait, what is this trying to solve?

"Convenience API" is really a shorthand for "functional API".  Two very
different use cases that the above suggestion doesn't address.  IMHO, it's not
worth giving up the functional API for picklability if the technical problems
cannot be resolved, especially given we already have the same problem for
namedtuples.

-Barry


More information about the Python-Dev mailing list