enum
Named constants grouped into a type.
Easy
from enum import Enum, auto, IntFlag
class State(Enum):
IDLE = auto(); RUNNING = auto(); ERROR = auto()
class Perm(IntFlag):
R = 4; W = 2; X = 1
State.IDLE.name, Perm.R | Perm.W
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.