On this page
  1. typing.TypeAliasType
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

typing.TypeAliasType

Prev: typing.TextIO | Up: typing
Rel: typing.AbstractSet, typing.Annotated, typing.Any, typing.assert_never
Ref: docs.python.org — typing.TypeAliasType
Tags: #public #python3 #stdlib #typing


Import

import typing
from typing import TypeAliasType

Signature & Overview

typing.TypeAliasType(...)

Type alias.

Usage

from typing import TypeAliasType

# Python 3.12+: runtime object created by `type Vector = list[float]`
Vector = TypeAliasType("Vector", list[float])
assert Vector.__name__ == "Vector" and Vector.__value__ == list[float]

Gotchas

REPL Inspect

from typing import TypeAliasType
help(TypeAliasType)

Linked from

Related notes