Am 03.05.2013 11:40, schrieb Steven D'Aprano:
> On 03/05/13 18:42, Antoine Pitrou wrote:
>> Le Fri, 3 May 2013 09:14:22 +1000, Nick Coghlan <[email protected]> a
>> écrit :
>
>>> I would suggest moving the field names into the class header for a class
>>> based convenience API:
>>>
>>> class Animal(Enum, members='cat dog'): pass
>>
>> This looks good to me (assuming some people don't like the special
>> attribute scheme).
>
> The problem is that this is not an expression, it is a statement. The
> advantage of the convenience function is not just that it is shorter, but
> that it is an expression.
But using that expression in any form other than
NAME = Enum('NAME', ...)
will again result in an unpicklable enum, which was the point of this thread.
Georg
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com