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

typing.get_args

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


Import

import typing
from typing import get_args

Signature & Overview

typing.get_args(tp)

Get type arguments with all substitutions performed.

Usage

from typing import get_args

assert get_args(dict[str, int]) == (str, int)
assert get_args(int) == ()

Gotchas

REPL Inspect

from typing import get_args
help(get_args)

Linked from

Related notes