Annotate types so checkers catch bugs before runtime; frameworks read them too.
Notes in the code saying what shape each value is meant to be. Python ignores them at runtime; your editor and your type checker do not.
On any codebase touched by more than one person, they catch a whole class of bug before it ever runs.
Type hints annotate parameters, returns, and variables with expected types. The typing vocabulary adds container shapes (list[int]), optionals (Optional[X]), and unions (A | B). Static checkers like mypy and pyright use them to catch bugs before runtime; Python itself ignores them at runtime, but libraries like Pydantic and FastAPI read them.
Type hints document the types of parameters, returns, and variables so a static checker—mypy or pyright—can flag mismatches in your editor or CI before the code runs. They're purely optional and Python ignores them at runtime, so there's no performance cost and no automatic enforcement. Their real leverage today is that frameworks read them: Pydantic validates data from hints and FastAPI generates validation and docs from them.
The BIGGEST Misconception About Type Hints In Python Explained — Indently, 5:14