Type hints, protocols, and good sense
summary
Argues that Python supports four typing modes (static/dynamic, nominal/structural), claims protocols (PEP 544) are the central feature that enable static duck typing, and shows a concrete fix for the typeshed median bug by adding a sortable Protocol plus a TypeVar so median returns the right element. Points out type hints run only at tooling time (mypy), can explode into complex annotations (the overloads for max example), and recommends using protocols and tests rather than requiring hints everywhere.
AI-written summary · about
