We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← All tracks
0 / 4
Data Modelling and Invariants
PythonDataclasses, `TypedDict`, `NamedTuple`, enums and validation at the boundary — making illegal states unrepresentable.
This track is written for Python, which isn't the mode you're browsing in.
0
/ 20 solved
· 5 articles
- 1. __slots__, part 1: what it actually saves (with numbers) Read
- 2. Choosing a record type: dataclass, NamedTuple, TypedDict, attrs, pydantic, msgspec Read
- 3. Descriptor-typed fields: the third way to compute a field Read
- 4. make_dataclass and building record types at runtime Read
- 5. Migration table: dataclass behaviour from 3.10 to 3.15 Read
- 6. Not solved yet. Dataclasses: slots, frozen, order
- 7. Not solved yet. asdict() and astuple(): the deep-copy tax
- 8. Not solved yet. Serializing dataclasses properly: round-trips, paths and schema versions
- 9. Not solved yet. Converters and validate-on-assignment: what attrs buys you
- 10. Not solved yet. dataclass_transform (PEP 681): making your own decorator type-checkable
- 11. Not solved yet. @dataclass is a code generator: what it emits
- 12. Not solved yet. eq, hash, and the eq/frozen/unsafe_hash truth table
- 13. Not solved yet. replace(), copy.replace(), and the mypy gap between them
- 14. Not solved yet. field(): the seven knobs that change generated behaviour
- 15. Not solved yet. frozen=True: what it buys, what it costs, and what it does not do
- 16. Not solved yet. Writing generic code over dataclasses under --strict
- 17. Not solved yet. kw_only, KW_ONLY and the inheritance ordering wall
- 18. Not solved yet. The mutable-default trap — and why the guard is weaker than you think
- 19. Not solved yet. NamedTuple: when a record should be a tuple
- 20. Not solved yet. Parse at the boundary, dataclasses in the core
- 21. Not solved yet. __post_init__ and InitVar: parameters that are consumed, not stored
- 22. Not solved yet. Runtime introspection after PEP 649: Field.type is not a type
- 23. Not solved yet. Generic dataclasses, Self, and the covariance question
- 24. Not solved yet. order=True, the 3.13 __eq__ change, and orderings that are not tuples
- 25. Not solved yet. __slots__, part 2: the eight things it breaks
Check yourself
4 questions · one attempt eachThese do not count toward finishing the track. They are here to catch the things that are easy to read past.
Why does the first dataclass raise, and what does default_factory fix?
@dataclass
class Bad:
xs: list = []
@dataclass
class Good:
xs: list = field(default_factory=list)
Question 1 of 4