On 06/29/2016 11:15 AM, Brett Cannon wrote: > On Wed, 29 Jun 2016 at 10:41 Ethan Furman wrote: >> There is a several-month-old request to add aenum's [1] AutoNumberEnum >> to the stdlib [2]. >> >> The requester and two of the three developers of Enum are in favor (the >> third hasn't chimed in yet). >> >> This new addition would enable the following: >> >> from Enum import AutoNumberEnum >> >> class Color(AutoNumberEnum): >> # auto-number magic is on >> Red >> Green >> Blue >> Cyan >> # magic turns off when non-enum is defined > > Is it going to subclass Enum or IntEnum? Enum. > Personally I would be quite > happy to never have to specify a value for enums ever again, but only if > they subclass Enum (since IntEnum is for compatibility with C stuff > where a specific value is needed I don't think users need to mess that > up by having the automatic numbering not work how they would expect). If a user really wants that they can, of course, specify both AutoNuberEnum and IntEnum in the class header. -- ~Ethan~
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