Ethan Furman added the comment:

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):
  ...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26988>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to