There are many types of Enum in Python
Enum/IntEnum/StrEnum(from Python 3.11)/Flag
Enum / IntEnum
from enum import Enum, IntEnum
class Color(Enum):
#class Color(IntEnum):
RED = 1
GREEN = 2
BLUE = 3
IntEnum
from enum import IntEnum, auto
class Color(IntEnum):
RED = auto()
GREEN = auto()
BLUE = auto()
# returns 1
print(int(Color.RED))
Flag
from enum import Flag, auto
class Color(Flag):
RED = auto()
GREEN = auto()
BLUE = auto()
purple = Color.RED | Color.BLUE