Python · Section 9

Type Hints and Static Typing

How to annotate variables, collections, and functions; the advanced typing tools for a dict with a known shape, narrowing a Union, and writing your own generic code; and the two real tools — mypy and pyright — that turn annotations into an enforced check.

Difficulty: intermediate130 min3 parts13 concepts