Typing and Generics
typing.Unpack
Expands a type-variable tuple into type arguments, or describes keyword arguments using a TypedDict (3.12+ for the latter usage). It is a static typing construct, not runtime iterable unpacking.
Formal Syntax & Structure
python syntaxpython
typing.Unpack[Ts]Return Value
type expression
Typing construct or runtime result as described; static typing rules are not runtime validation.
Working Example
Example Snippetpython
from typing import TypedDict, Unpack
class Options(TypedDict): width: int label: strdef render(**kwargs: Unpack[Options]) -> str: return kwargs['label'] * kwargs['width']print(render(width=3,label='x'))