PyDocs

Nav

Data Types

GenericAlias

types

class · Added in 3.9
  • GenericAlias(t_origin, t_args)
Represent a PEP 585 generic type

For example, for t = list[int], t.__origin__ is list and t.__args__
is (int,).
Changed in 3.9.2
  • 3.9.2: This type can now be subclassed.
1 Example
>>> from types import GenericAlias

>>> list[int] == GenericAlias(list, (int,))
True
>>> dict[str, int] == GenericAlias(dict, (str, int))
True
from the Python docs
See Also
No see-alsos for types/GenericAlias
0 Notes
No notes for GenericAlias