Skip to content
Prev Previous commit
Next Next commit
Add one more example to docs
  • Loading branch information
ilevkivskyi committed Jan 31, 2017
commit 3e3532a987f2d56b8ea679fc201eff7597ead9d5
9 changes: 6 additions & 3 deletions typing_inspect/typing_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,15 @@ def get_args(tp, evaluate=False):
basic simplifications used by Union constructor are performed.
If `evaluate` is False (default), report result as nested tuple, this matches
the internal representation of types. If `evaluate` is True, then all
type parameters are applied (this could be expensive). Examples::
type parameters are applied (this could be time and memory expensive).
Examples::

get_args(Union[int, Tuple[T, int]][str]) == (int, (Tuple, str, int))
get_args(Union[int, Union[T, int], str][int]) == (int, str)
get_args(int) == ()
get_args(Union[int, Union[T, int], str][int]) == (int, str)
get_args(Union[int, Tuple[T, int]][str]) == (int, (Tuple, str, int))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Callable examples would be helpful here too.


get_args(Union[int, Tuple[T, int]][str], evaluate=True) == \
(int, Tuple[str, int])
get_args(Dict[int, Tuple[T, T]][Optional[int]], evaluate=True) == \
(int, Tuple[Optional[int], Optional[int]])
"""
Expand Down