Object Oriented
Object-Oriented Python
Tier 4 — modelling with classes and understanding Python's object system deeply. Classes and instances, class vs instance state, inheritance and super, dunder methods, properties and descriptors, and advanced OOP (MRO, ABCs, dataclasses). From "what is a class" to the data model.
Suggest an editObject-Oriented Python
A class bundles data (attributes) with behaviour (methods) and lets you stamp out many objects from one definition. Tier 4 takes you from your first class to the machinery that makes Python's own types work. The thesis of the tier: objects in Python aren't a separate world — they're the object model from Tier 3 with syntax for defining your own types, and the "dunder" methods are how your objects plug into the language's built-in behaviour.
Six chapters, in order:
- Classes & Objects —
class,__init__, instance attributes, methods, andself. - Class vs Instance; Encapsulation — shared class state vs per-instance state,
@classmethod/@staticmethod, the underscore conventions. - Inheritance &
super— subclassing, overriding,super(), is-a vs has-a. - Dunder Methods & Operator Overloading —
__repr__,__eq__/__hash__,__len__/__getitem__, operators. - Properties & Descriptors —
@property, validation, and the descriptor protocol. - Advanced OOP — MRO & C3, multiple inheritance, mixins, abstract base classes,
dataclasses.
These assume Tier 3 — especially the object model (names and objects), functions in depth (decorators, which @property/@classmethod are), and hashing (which __eq__/__hash__ builds on). The dunder methods here feed directly into The Data Model in Tier 5.
📘 How to read the Intuition boxes. Each one is built in three moves:
- The mechanism — what the interpreter is actually doing.
- A concrete bite — a specific, runnable way the naive assumption fails.
- The earned rule — the decision heuristic, now justified rather than asserted, plus its cost.