[Python-ideas] PEP for enum library type?
Ethan Furman
ethan at stoneleaf.us
Thu Feb 14 05:50:36 CET 2013
On 02/13/2013 05:58 PM, Ryan Hiebert wrote:
> On Feb 13, 2013, at 4:57 PM, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
>
>> and maybe also:
>>
>> class Color(Enum):
>> # 0 1 2 3
>> RED, GREEN, BLUE, YELLOW, *end = seq()
>>
>> class Color(Enum):
>> # 3 4 5 6
>> RED, GREEN, BLUE, YELLOW, *end = seq(3)
>>
>> class Flag(Enum):
>> # 1 2 4 8 16
>> FOO, BAR, BAZ, BOO, SPAM, *end = flags()
>>
>> (yes, it *is* possible to implement it without playing with stack frames...)
>
> This suggestion interests me most. Would it require language changes for that *end stuff?
Already is, since 3.0 I believe.
http://www.python.org/dev/peps/pep-3132/
--
~Ethan~
More information about the Python-ideas
mailing list