Ethan Furman wrote:
--> class Color(Enum):
...     red, green, blue
...

--> class MoreColor(Color):
...     red, orange, yellow
...

--> type(MoreColor.red) is MoreColor
False

This argument no longer applies, since we're not
allowing enums to be extended.

class Color(Enum):
    red = e()
    green = e()
    blue = e()

and you can keep using `e()` for all your enumerations, since you don't care what actual value each enumeration member happens to get.

I don't think it's true that people wanting auto-numbering
don't care what values they get. Rather, they probably want
ordinal values assigned separately and consecutively for
each type, as in every other language I'm aware of that
provides auto-numbered enums.

If you *really* don't care what the values are, there's no
need for the items to have values at all.

--
Greg

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to