Skip to main content

Typing Features and PEPS

Typing Features and PEPS available in each Python Version.

Feature (click PEP for details)What it adds / looks likeIntroduced in
PEP 484 -- Core type hints & typing moduledef add(a: int, b: int) -> int:3.5
PEP 526 -- Variable annotationscount: int = 03.6
PEP 563 -- from __future__ import annotations (lazy eval)Annotations stored as strings3.7 (future‑flag)
PEP 544 -- Protocols (structural typing)class Jsonable(Protocol): ...3.8
PEP 589 -- TypedDictclass User(TypedDict): ...3.8
PEP 586 -- Literal typesdef log(level: Literal["info","warn"]): ...3.8
PEP 591 -- Final qualifierTOKEN: Final[str] = "..."3.8
PEP 585 -- Built‑in genericslist[int], dict[str, Any]3.9
PEP 593 -- Annotatedx: Annotated[int, "units=px"]3.9
PEP 604 -- Union syntaxint | None3.10
PEP 612 -- ParamSpec / Concatenatedecorator‑safe generics3.10
PEP 613 -- TypeAlias qualifierVector: TypeAlias = list[float]3.10
PEP 647 -- TypeGuard for narrowingdef is_str(x) -> TypeGuard[str]: ...3.10
PEP 655 -- Required / NotRequired for TypedDictoptional vs. mandatory keys3.11
PEP 646 -- Variadic generics (TypeVarTuple, Unpack)tensor shapes, 2‑D arrays, ...3.11
PEP 673 -- Self typefluent APIs: def set(...) -> Self:3.11
PEP 681 -- dataclass_transform helperlibraries like Pydantic, attrs3.11
PEP 695 -- Class‑level generics syntaxclass Box[T]: ...3.12
PEP 698 -- @override decoratorflag intentional overrides3.13
PEP 649 -- New deferred‑eval algorithm (replaces PEP 563)becomes the default3.14