Message270107
I like AutoEnum.
Another auto-related thought: one of the more common Enum questions on StackOverflow is how to automatically have the value be the stringified version of the name:
class Huh(Enum):
this
that
those
Huh.this.name == Huh.this.value
# True
So the question then becomes: is there a way to easily support both auto-number and auto-string values?
While I don't have the auto-string feature yet in aenum, the system I am using to specify optional settings looks like this:
------
class Color(Enum, settings=AutoNumber):
red
...
------
------
class Color(IntEnum, settings=AutoNumber):
red
...
------
------
class Color(Enum, settings=AutoName):
red
...
------
The other option, of course, is to just stick with the prebuilt method of doing things:
class Color(AutoEnum):
...
class Color(AutoEnum, IntEnum):
...
class Color(AutoNameEnum):
... |
|
Date |
User |
Action |
Args |
2016-07-10 17:42:18 | ethan.furman | set | recipients:
+ ethan.furman, barry, eli.bendersky, John Hagen |
2016-07-10 17:42:18 | ethan.furman | set | messageid: <1468172538.35.0.576778185899.issue26988@psf.upfronthosting.co.za> |
2016-07-10 17:42:18 | ethan.furman | link | issue26988 messages |
2016-07-10 17:42:18 | ethan.furman | create | |
|