Python enum в int
# using enum34
from enum import Enum
class Nationality(Enum):
PL = 0, 'Poland'
DE = 1, 'Germany'
FR = 2, 'France'
def __new__(cls, value, name):
member = object.__new__(cls)
member._value_ = value
member.fullname = name
return member
def __int__(self):
return self.value
Wild Worm