Records: class vs dataclass vs namedtuple
P28.data-modelling.01 · Audience: Guest, IT/ML learner, Language professional
Where next?
Later in Data Modelling
This module unlocks
Go up a level
P28.data-modelling.01 · Audience: Guest, IT/ML learner, Language professional
Later in Data Modelling
This module unlocks
Go up a level
Welcome to Objects & Data Modelling — the first pillar of the Advanced
Python discipline. Python gives you several ways to model a bundle of data, and
picking the right one is a daily design decision. This ladder starts there:
a plain class, a dataclass, and a namedtuple, and when each earns its keep.
Each rung below is a three-panel workspace: instructions on the left, a code editor in the middle, and output + test results on the right.
The code runs entirely in your browser (Pyodide — Python compiled to WebAssembly); nothing leaves your machine.
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
Loading exercise…
Loading exercise…
Loading exercise…
Loading your notes...