The Python Object Model

She has been writing Python for eighteen months. She knows it well enough to have been promoted. She reaches for list comprehensions the way other people reach for a pen — without thinking. So when her tech lead leaves a comment on her pull request that says "make this iterable," she does what any confident mid-level developer does: she adds a for loop and calls it done. The comment comes back: "I mean make the class itself iterable." She stares at that for a long time. It isn't that she doesn't know Python. It's that she's been operating on the surface of it — writing code that works without ever asking why it works. She knows len() exists. She has never wondered what len() is actually doing when she calls it on her custom class. She knows that for loops exist. She has never wondered what a for loop is actually asking the object it iterates over. She has been a professional tenant of the Python runtime without ever reading the lease. This week is the lease. Python runs a precise, documented protocol of double-underscore methods that determines how your objects behave when built-in machinery reaches for them. len(), in, for, +, >, bool() — all of it routes through this protocol. Once you can see the machinery, the language stops feeling like a collection of behaviors you've memorized and starts feeling like a system you actually understand. That shift is what this week is about.