← All notes

Declare a Python 3.12 type parameter list or a type alias statement

Answer: PEP 695 specifies an improved syntax for type parameters on a generic class, function, or type alias. It also adds a new statement for declaring type aliases. In the typing docs, these objects can be created through special syntax: type parameter lists and the type statement.

Type parameter lists

A generic type is typically declared by adding type parameters after the class name, such as class Mapping[KT, VT]. The same bracket list works on a function. They can also be created without the dedicated syntax, as documented for Python 3.11 and earlier, using TypeVar.

The type statement

PEP 484 introduced type variables into the language. PEP 612 added parameter specifications, and PEP 646 added variadic type variables. It also introduces a new statement for declaring type aliases.

| type parameter list | type statement | |---|---| | type parameter list | List of type parameters after the class name | | type statement | New statement for declaring type aliases | | TypeVar | Created without the dedicated syntax | | PEP 695 | Improved syntax for specifying type parameters |

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 695 – Type Parameter Syntax; 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 695 – Type Parameter Syntax; Python docs, typing — Support for type hints. Public-Domain; PSF-2.0.

Cite this

Permanent ID: iil:note:s63nmyzj

iinventedlight. 2026. "Declare a Python 3.12 type parameter list or a type alias statement." iinventedlight Library, iil:note:s63nmyzj, version of 2026-11-19. https://iinventedlight.com/library/notes/pep-695-type-parameters/. License: CC-BY-4.0.

@misc{iil_note_s63nmyzj,
  author = {{iinventedlight}},
  title = {{Declare a Python 3.12 type parameter list or a type alias statement}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-19},
  url = {https://iinventedlight.com/library/notes/pep-695-type-parameters/},
  note = {Permanent ID iil:note:s63nmyzj. 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/pep-695-type-parameters.md.