TypeVarTuple
E911252
TypeVarTuple is a Python typing construct introduced in PEP 646 that represents a variadic type variable, allowing type annotations to express an arbitrary number of type parameters.
Statements (44)
| Predicate | Object |
|---|---|
| instanceOf |
Python typing feature
ⓘ
typing construct ⓘ variadic type variable ⓘ |
| availableFromModule |
typing
ⓘ
typing_extensions ⓘ |
| canBeUnpackedWith | Unpack ⓘ |
| category | static typing ⓘ |
| commonlyUsedWith |
Generic
ⓘ
typing.Unpack ⓘ |
| definedIn | Python standard library typing module ⓘ |
| designGoal |
allow expressing arbitrary-length homogeneous or heterogeneous type sequences
ⓘ
support variadic generics in Python type system ⓘ |
| enables |
forwarding of arbitrary type argument lists
ⓘ
shape-polymorphic typing for tuples ⓘ tuple-type parameter packs ⓘ |
| exampleUsage |
class Array(Generic[*Ts]): ...
ⓘ
def f(*args: *Ts) -> Tuple[*Ts]: ... ⓘ |
| introducedInPEP | PEP 646 NERFINISHED ⓘ |
| introducedInPythonVersion | Python 3.11 NERFINISHED ⓘ |
| isCheckedBy |
static type checkers such as mypy
ⓘ
static type checkers such as pyright ⓘ |
| kind | variadic type parameter ⓘ |
| language | Python NERFINISHED ⓘ |
| originPEPStatus | accepted GENERATED ⓘ |
| parameterizes |
generic classes
ⓘ
generic functions ⓘ |
| pepTitle | PEP 646: Variadic Generics NERFINISHED ⓘ |
| relatedTo |
ParamSpec
ⓘ
TypeVar ⓘ Unpack ⓘ |
| restriction | must be unpacked with Unpack when used in most type positions ⓘ |
| semantics | represents an ordered sequence of type arguments ⓘ |
| status | standardized in Python typing ⓘ |
| supports |
typing of APIs that preserve argument list shapes
ⓘ
typing of n-dimensional array shapes ⓘ typing of variadic tuple-like structures ⓘ |
| supportsFeature | variadic generics ⓘ |
| syntaxExample | Ts = TypeVarTuple('Ts') ⓘ |
| usedFor |
defining generic classes with variable-length type arguments
ⓘ
defining generic functions with variable-length type arguments ⓘ representing an arbitrary number of type parameters ⓘ typing of variadic parameter packs ⓘ |
| worksWith |
Callable types via ParamSpec and TypeVarTuple combinations
ⓘ
tuple types ⓘ |
Referenced by (1)
Full triples — surface form annotated when it differs from this entity's canonical label.