Python generic types

E265438

Python generic types are a type system feature that allows developers to write functions, classes, and data structures that operate on values of multiple types while preserving static type information.

All labels observed (3)

How this entity was disambiguated

Statements (49)

Predicate Object
instanceOf programming language concept ⓘ
type system feature ⓘ
allows defining reusable type-safe abstractions ⓘ
parameterizing collections by element type ⓘ
commonlyUses Generic ⓘ
TypeVar ⓘ
typing.Callable ⓘ
typing.Dict ⓘ
typing.Iterable ⓘ
typing.List ⓘ
typing.Mapping ⓘ
typing.Optional ⓘ
typing.Protocol ⓘ
typing.Sequence ⓘ
typing.Tuple ⓘ
typing.Union ⓘ
compatibleWith runtime duck typing in Python ⓘ
definedInModule typing ⓘ
enables writing code that operates on multiple types ⓘ
extendedIn PEP 585 ⓘ
PEP 604 ⓘ
PEP 695 ⓘ
formalizedIn PEP 483 ⓘ
introducedIn PEP 484 ⓘ
preserves static type information ⓘ
supportedBy PyCharm type checker ⓘ
Pyre ⓘ
Pyright ⓘ
mypy ⓘ
supports bounded type variables ⓘ
constraints on type variables ⓘ
contravariant type variables ⓘ
covariant type variables ⓘ
generic classes ⓘ
generic data structures ⓘ
generic functions ⓘ
generic protocols ⓘ
parametric polymorphism ⓘ
recursive types (via typing module features) ⓘ
static type checking ⓘ
type aliases ⓘ
type parameters ⓘ
type variables ⓘ
syntaxChangedIn Python 3.9 with built-in generics like list[int] ⓘ
syntaxImprovedIn Python 3.10 with PEP 604 union types ⓘ
linked to: Python 3.10
usedFor catching type errors before runtime ⓘ
documenting code intent ⓘ
improving IDE autocompletion ⓘ
usedIn Python ⓘ

How these facts were elicited

Referenced by (3)

Full triples — surface form annotated when it differs from this entity's canonical label.

PEP 695 → targets → Python generic types ⓘ
Type Parameter Syntax → category → Python generics ⓘ
linked to: Python generic types
PEP 585 → title → Type Hinting Generics In Standard Collections ⓘ
linked to: Python generic types