Checking your account

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

Type Hints and Function Contracts

The Development of Python Type Hints

BOTIE

Python gained function-annotation syntax before the typing system assigned a common interpretation to it. Different tools could attach different meanings to the same syntax. PEP 484 established a vocabulary for type hints for Python 3.5, allowing optional static analysis to use consistent expectations.

Static analysis follows the program before executing its normal work. Runtime validation inspects values that actually arrive. These are different tasks: a checker can flag a known string passed to a numerical function, while an external response still needs a boundary that checks its contents.

Sources for this history