Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42317: Improve docs of typing.get_args concerning Union #23254

Merged
merged 4 commits into from
Nov 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bpo-42317: Improve docs of typing.get_args concerning Union
  • Loading branch information
Dominik1123 committed Nov 12, 2020
commit 5a5ff4d75ee6ad5ccb325e58a8735f696ca69f63
2 changes: 2 additions & 0 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,8 @@ Introspection helpers
For a typing object of the form ``X[Y, Z, ...]`` these functions return
``X`` and ``(Y, Z, ...)``. If ``X`` is a generic alias for a builtin or
:mod:`collections` class, it gets normalized to the original class.
If ``X`` is a :class:`Union`, the order of ``(Y, Z, ...)`` may be different
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If ``X`` is a :class:`Union`, the order of ``(Y, Z, ...)`` may be different
If ``X`` is a :class:`Union` contained in another generic type, the order of ``(Y, Z, ...)`` may be different

from the order of the original arguments ``[Y, Z, ...]``.
For unsupported objects return ``None`` and ``()`` correspondingly.
Examples::

Expand Down