Runtime Types

types.GenericAlias — runtime type

A runtime representation of a parameterized built-in generic such as list[int]. GenericAlias(origin, args) constructs an equivalent alias. __origin__ and __args__ expose its components. Instantiating it creates the underlying class without automatic element checks; parameterized aliases cannot normally be used as isinstance targets.

Formal Syntax & Structure

python syntaxpython
types.GenericAlias

Return Value

type

The class object types.GenericAlias; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
import typesvalue = list[int]print(isinstance(value, types.GenericAlias))
Python Reference