Module 03 ยท Classes & Typing โ Lesson 2 of 4 ยท ~8 min
Dataclasses
What's that @ doing there?
@dataclass is your first decorator โ a function that wraps another piece of code to add behavior, written with @ directly above a class or def. Think of it like a Swift property wrapper (@State, @Published) you've already seen: same @Name shape, same idea of 'this attaches extra behavior', just applied to a whole class here instead of one property. You'll see @ again soon (Flask routes, FastAPI decorators) โ it's a core Python pattern, not a one-off.