Enums & validated models
P28.protocols-abcs.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Protocols vs ABCs
P28.protocols-abcs.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Protocols vs ABCs
Two everyday data-modelling patterns close out the pillar. An enum replaces a scatter of magic strings with a small, closed set of named members — safer, self-documenting, and impossible to mistype. A validated model applies the "parse, don't just store" principle: data is checked and normalised at the boundary, so the rest of your program only ever sees valid values (the idea behind libraries like pydantic).
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 your notes...