ID EN
Typing

get_args

Python 3.11

Get type arguments with all substitutions performed: for a typing object of the form X[Y, Z, ...] return (Y, Z, ...).

Syntax

PYTHON
typing.get_args(tp)

Examples

Example 1
PYTHON
assert get_args(int) == ()
assert get_args(Dict[int, str]) == (int, str)
assert get_args(Union[int, str]) == (int, str)

See Also

Literal