Tutorial sequence

Object Model and Protocols

5of 5 published
  1. 01

    intermediate / 24 min

    Iterators change the question

    Stop asking where the whole collection is and start asking for the next useful value.

    Read
  2. 02

    intermediate / 25 min

    Context managers encode cleanup

    Make resource lifetime visible, exception-safe, and reusable with the context management protocol.

    Read
  3. 03

    advanced / 26 min

    Containers are bundles of protocols

    Design collection behavior by choosing iteration, membership, sizing, indexing, and mutation deliberately.

    Read
  4. 04

    advanced / 26 min

    Callable objects and function-like behavior

    Use the call protocol to combine behavior with explicit state without pretending every callable is a function.

    Read
  5. 05

    advanced / 27 min

    Structural typing meets runtime protocols

    Use typing protocols, ABCs, and capability checks without confusing static compatibility with runtime proof.

    Read