Type Aliases (3.12+)
PY · Variables & Typessyntax
type AliasName = existing_typeexample
type UserId = int
type Coordinate = tuple[float, float]
type UserMap = dict[UserId, str]
position: Coordinate = (40.71, -74.01)Note The type statement (Python 3.12+) replaces TypeAlias from typing. It supports lazy evaluation and generic parameters.