I've read that when using Enums in python 3 you have the option to use auto to automatically ennumerate the elements. It seems that in python2 this is not possible.
However I found this doc which permits auto numeration. However it is not working well
In the docs we have
class AutoNumber(Enum):
def __new__(cls):
value = len(cls.__members__) + 1
obj = object.__new__(cls)
obj._value_ = value
return obj
class Color(AutoNumber):
red = ()
green = ()
blue = ()
Then in the docs they give us as example
Color.green.value == 2
and yes, green give us 2. But red give us 3! and blue give us 1
so the elements are of value 3,2,1 and not 0,1,2 or 1,2,3 as I assumed.
I've tried to modify AutoNumber without success.
How can I get the correct numeration? (0,1,2) (1,2,3) or (-1,0,1) is ok