Python · Classes and Object Design · Intermediate · 30 min read
Python Dataclasses, Enums and NamedTuples: Model Data Concisely and Safely
Model data without boilerplate. Learn dataclasses (fields, defaults, default_factory, frozen, slots, order, __post_init__, field options), NamedTuple and typing, Enum, IntEnum, StrEnum, Flag and auto, when to choose each, validation, serialisation, immutability and performance trade-offs.
Create an account to start
Create a free account to see what this lesson covers
- Every free lesson in every section, in full
- Track your progress and pick up where you left off
- Free practice questions and an incident simulation
- Takes under a minute: name, email and a password
No card needed. Full access to Python is a paid upgrade you can choose later.