[Python-checkins] bpo-42317: Improve docs of typing.get_args concerning Union (GH-23254)

miss-islington webhook-mailer at python.org
Sun Nov 15 20:52:33 EST 2020


https://github.com/python/cpython/commit/2369759a47c5292bacf2eef17b4e2388b7d36675
commit: 2369759a47c5292bacf2eef17b4e2388b7d36675
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2020-11-15T17:52:22-08:00
summary:

bpo-42317: Improve docs of typing.get_args concerning Union (GH-23254)

(cherry picked from commit c3b9592244a9112d8af9610ff1c4e1e4cd4bfaca)

Co-authored-by: Dominik1123 <15989985+Dominik1123 at users.noreply.github.com>

files:
M Doc/library/typing.rst

diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index a5f8b0403f803..324abdeb5eb5b 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -1687,6 +1687,9 @@ 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` contained in another generic type,
+   the order of ``(Y, Z, ...)`` may be different from the order of
+   the original arguments ``[Y, Z, ...]`` due to type caching.
    For unsupported objects return ``None`` and ``()`` correspondingly.
    Examples::
 



More information about the Python-checkins mailing list