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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4