← How-To Guides How-To How to use type hints Add annotations like def f(x: int) -> str:. Use list[int], dict[str, int], Optional, etc. Type hints Improves tooling and docs. def greet(name: str) -> str: return f'Hello, {name}'