Checking your account

You can read the lesson while its saved answers and constructions load. Learning controls will open once that work is ready.

Composition and Interchangeable Components

Structural Protocols in Python

BOTIE

Python programs commonly accepted objects because they supported a needed operation, rather than because they inherited from one required base class. Adding static types raised a practical question: how could tools describe those existing collaborations without requiring every implementation to change its ancestry?

PEP 544 introduced Protocol for Python 3.8 to describe structural interfaces. An object can satisfy a protocol through its supported members without explicitly inheriting from that protocol. This documents interchangeable roles while leaving runtime validation and the real behavior of a component to the application.

Sources for this history