ParamSpec

E911253

ParamSpec is a Python typing construct that allows you to capture and reuse the parameter types of callable objects, enabling more precise type annotations for higher-order functions.

All labels observed (3)

How this entity was disambiguated

Statements (45)

Predicate Object
instanceOf PEP 612 feature
Python typing feature
typing construct
authorOfPEP PEP 612 authors
availableFromPythonVersion 3.10
backportedInModule typing_extensions
canBeUsedWith Callable
Concatenate
ParamSpecArgs
ParamSpecKwargs
captures keyword parameters of a callable
positional parameters of a callable
category variadic type parameter
definedInModule typing
designGoal allow parameter list variance separate from return type
support precise typing of higher-order functions
enables forwarding of *args and **kwargs types
type-safe decorators
type-safe function wrappers
hasComponent ParamSpec.args
ParamSpec.kwargs
introducedIn PEP 612
isVariadic true
limitations cannot be used for non-callable generic parameters
cannot directly express arbitrary argument transformations
namespace typing.ParamSpec
typing_extensions.ParamSpec
parameterKind parameters of a callable
partOf Python type system
relatedTo Callable
Concatenate
TypeVar
TypeVarTuple
requires type checkers with PEP 612 support
semantics represents the full parameter specification of a callable
status standard feature in Python 3.10 and later
supports binding to callable parameter lists
syntaxExample P = ParamSpec('P')
typicalUsage def wrapper(*args: P.args, **kwargs: P.kwargs) -> ReturnType:
usedFor capturing parameter types of callables
generic callable parameter lists
precise type annotations for decorators
preserving callable signatures in wrappers
reusing parameter types of callables
typing higher-order functions

How these facts were elicited

Referenced by (4)

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

Type Parameter Syntax relatedTo ParamSpec
PEP 612 title Parameter Specification Variables
linked to: ParamSpec
PEP 612 introducedConcept ParamSpec
PEP 612 relatedTo typing.ParamSpec
linked to: ParamSpec