Typing and Generics

typing.TypeVarTuple

Represents a variable-length sequence of types, not a single type. Unpack it in a tuple or generic parameter list. Defaults are supported from Python 3.13.

Formal Syntax & Structure

python syntaxpython
typing.TypeVarTuple(name, *, default=NoDefault)

Parameters & Attributes

NameTypeDescription
namestrName of the variadic type parameter.
defaultobjectDefault type sequence.

Return Value

TypeVarTuple

Typing construct or runtime result as described; static typing rules are not runtime validation.

Working Example

Example Snippetpython
from typing import TypeVarTuple
Ts = TypeVarTuple('Ts')def echo(values: tuple[*Ts]) -> tuple[*Ts]: return valuesprint(echo((1,'x',True)))
Python Reference