enum

An Enum is a fixed set of named values. Use one in place of "magic" strings or numbers like status = 2 or status = "pausd". A typo in a string fails quietly. A typo in Status.PAUSD raises AttributeError at once.

Each member has a name and a value. auto() picks the values for you when you don't care what they are. You can look members up by value with Status(1) or by name with Status["DONE"], and loop over them all.

Members are singletons, so compare them with is. You can't reassign a member after the class is made.

StrEnum and IntEnum make members that also act like strings or ints, which helps when the values go to JSON or a database.

Enums pair well with match statements and come up in System design answers when you model states, like an order that is PLACED, SHIPPED or DELIVERED.

Run it, then add a CANCELLED member.