Skip to content

Concepts: Classes and objects

Short essays on the ideas underneath classes, dunders, and inheritance. The "ah, that's why" layer beneath the syntax — read once and keep coming back to when something surprises you in practice.

Essays in this section

  • When to reach for classes — why a function and a dict often beat a class, and the handful of signals that tell you a class is worth the ceremony.
  • Composition over inheritance — what the slogan actually means, why inheritance looks tempting, and the specific failure modes that composition avoids.