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

typing.get_origin

Prev: typing.get_args | Up: typing | Next: typing.get_overloads
Rel: typing.AbstractSet, typing.Annotated, typing.Any, typing.assert_never
Ref: docs.python.org — typing.get_origin
Tags: #public #python3 #stdlib #typing


Import

import typing
from typing import get_origin

Signature & Overview

typing.get_origin(tp)

Get the unsubscripted version of a type.

Usage

from typing import get_origin

assert get_origin(list[int]) is list
assert get_origin(dict[str, float]) is dict
assert get_origin(int) is None

Gotchas

REPL Inspect

from typing import get_origin
help(get_origin)

Linked from

Related notes