PyDocs

Nav

Development Tools

get_args

typing

function · Added in 3.8 (source)
  • get_args(tp)
Get type arguments with all substitutions performed.

For unions, basic simplifications used by Union constructor are performed.

Examples::

    >>> T = TypeVar('T')
    >>> assert get_args(Dict[str, int]) == (str, int)
    >>> assert get_args(int) == ()
    >>> assert get_args(Union[int, Union[T, int], str][int]) == (int, str)
    >>> assert get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
    >>> assert get_args(Callable[[], T][int]) == ([], int)
0 Examples
No examples for typing/get_args.
See Also
No see-alsos for typing/get_args
0 Notes
No notes for get_args