Type hints document expected types without being enforced at runtime by the interpreter itself; tools like `mypy` check them statically.
python
from typing import Optional
def get_balance(address: str) -> float:
return 0.0
def find_user(id: int) -> Optional[dict]:
return None
Balances = dict[str, float] # type alias (Python 3.9+)Since Python 3.9, built-in generics (`list[int]`, `dict[str, int]`) work directly without importing from `typing`. Hints improve editor autocompletion and catch bugs before runtime, but Python remains dynamically typed regardless.