[Python-ideas] PEP for enum library type?

Ryan Hiebert ryan at ryanhiebert.com
Thu Feb 14 02:58:57 CET 2013


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?


More information about the Python-ideas mailing list