Type Hints / Annotations
PY · Variables & Typessyntax
name: type = valueexample
price: float = 19.99
items: list[str] = ["apple", "bread"]
user_map: dict[str, int] = {"alice": 1}output
# No runtime enforcement — hints are for tools and readersNote Type hints do not prevent wrong types at runtime. Use mypy or pyright for static checking. Since 3.12, you can use the new type statement for aliases.