← All notes

Forward a callable's parameters with typing.ParamSpec

Answer: ParamSpec is a parameter specification variable, a specialized version of type variables. PEP 612 proposes typing.ParamSpec and typing.Concatenate so you can forward the parameter types of one callable over to another callable, which is what decorator annotations need.

Why Callable was not enough

There currently are two ways to specify the type of a callable: the Callable syntax from PEP 484, and callback protocols from PEP 544. Neither of these support forwarding those parameter types.

In type parameter lists

In type parameter lists, parameter specifications can be declared in the new 3.12 syntax as well as with ParamSpec("name"). Concatenate is proposed together with ParamSpec. A Callable argument list can also be a ParamSpec, Concatenate, or an ellipsis (...).

| ParamSpec | Concatenate | |---|---| | ParamSpec | Parameter specification variable | | Concatenate | Adds parameters in front of a ParamSpec | | Callable | Cannot forward parameter types by itself | | decorator | Difficult to annotate without ParamSpec |

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python PEPs, PEP 612 – Parameter Specification Variables; Python docs, typing — Support for type hints. Public-Domain; PSF-2.0. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python PEPs, PEP 612 – Parameter Specification Variables; Python docs, typing — Support for type hints. Public-Domain; PSF-2.0.

Cite this

Permanent ID: iil:note:qajc5avr

iinventedlight. 2026. "Forward a callable's parameters with typing.ParamSpec." iinventedlight Library, iil:note:qajc5avr, version of 2026-11-19. https://iinventedlight.com/library/notes/python-typing-paramspec/. License: CC-BY-4.0.

@misc{iil_note_qajc5avr,
  author = {{iinventedlight}},
  title = {{Forward a callable's parameters with typing.ParamSpec}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-19},
  url = {https://iinventedlight.com/library/notes/python-typing-paramspec/},
  note = {Permanent ID iil:note:qajc5avr. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-typing-paramspec.md.