Type hints communicate intent
Type hints annotate variables, parameters and return values. Python generally does not enforce them automatically at runtime, but editors, linters and static type checkers can use them to identify mistakes before the program runs.
Annotate public boundaries
Type hints are particularly valuable on public functions, service interfaces and complex data structures. They make it easier for another developer to understand what a function expects without reading its entire implementation.
Hints do not replace validation
External data can still contain anything. HTTP requests, JSON and user input must be validated at runtime even when the receiving function has type annotations.
Practice: add type hints to a function that accepts a list of prices and returns the highest price, including an explicit policy for an empty list.