[Python-ideas] PEP for enum library type?
Barry Warsaw
barry at python.org
Wed Feb 13 19:04:29 CET 2013
On Feb 13, 2013, at 10:08 AM, Steven D'Aprano wrote:
>> >>> from flufl.enum import make
>> >>> make('Colors', 'RED GREEN BLUE'.split())
>> <Colors {RED: 1, GREEN: 2, BLUE: 3}>
>
>That reminds me of namedtuple. I could live with something close to that.
>
>Like namedtuple, it should do the split for you.
Part of the reason for defining make() the way it is, is so that you can use
any iterator in the second argument. I suppose you could special case
splitting if the second argument is a single string, but I'm not sure this
special case is special enough.
-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-ideas/attachments/20130213/4efed0d2/attachment.pgp>
More information about the Python-ideas
mailing list