Skip to content

Python Interfaces

A good Python interface makes the valid operation obvious and the invalid state difficult to construct.

flowchart LR Caller --> Contract[function / Protocol / model] --> Implementation

Progress from clear functions, through Protocols and models, to cross-team contracts and shared API governance. Practice by replacing one dictionary-shaped boundary with an explicit typed contract.