A product combines fields: a lamp can have a power setting AND a color. A choice, sometimes called a sum, represents one alternative OR another. Separate alternatives are useful when each carries different information: a pickup has a shelf; a delivery has an address. A single record with all fields might allow combinations that make no sense, such as a pickup with an address but no shelf.
When alternatives are just names, use an enum:
from enum import Enum
class Signal(Enum):
STOP = "stop"
GO = "go"
signal = Signal("go")
print(signal, signal.name, signal.value)
print(signal == Signal.GO)
Signal.GO GO go
True
Signal.GO is the member; GO is its name and "go" its stored value. Signal("unknown") raises ValueError; accessing an undefined member raises AttributeError. Convert or validate external input at a boundary. An annotation such as signal: Signal is not runtime enforcement, and consumers are not automatically forced to handle every member.
A union annotation such as str | None describes alternatives in Python 3.10 and newer. None can signal absence; use is None to distinguish it from the empty string. Type hints help readers and static tools but do not validate values at runtime. For choices carrying different fields, the next lesson uses separate classes.