This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients John Hagen, barry, eli.bendersky, ethan.furman
Date 2016-07-10.17:42:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468172538.35.0.576778185899.issue26988@psf.upfronthosting.co.za>
In-reply-to
Content
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):
  ...
History
Date User Action Args
2016-07-10 17:42:18ethan.furmansetrecipients: + ethan.furman, barry, eli.bendersky, John Hagen
2016-07-10 17:42:18ethan.furmansetmessageid: <1468172538.35.0.576778185899.issue26988@psf.upfronthosting.co.za>
2016-07-10 17:42:18ethan.furmanlinkissue26988 messages
2016-07-10 17:42:18ethan.furmancreate