diff options
author | Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> | 2021-02-09 01:57:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-09 01:57:11 (GMT) |
commit | 5f77dee0560e923935203dc4c49279ddb19f57ed (patch) | |
tree | 26164b724293a038e757fd205aec0371b3c55b3f /Doc/whatsnew | |
parent | d65b9033d6d092552775f6f5e41e7647100f9f2c (diff) | |
download | cpython-5f77dee0560e923935203dc4c49279ddb19f57ed.zip cpython-5f77dee0560e923935203dc4c49279ddb19f57ed.tar.gz cpython-5f77dee0560e923935203dc4c49279ddb19f57ed.tar.bz2 |
Improve docs of PEP 604 Union (#24301)
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.10.rst | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index fa8b6aa..96892ba 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -193,7 +193,13 @@ Type hints can now be written in a more succinct manner:: return number ** 2 -See :pep:`604` for more details. +This new syntax is also accepted as the second argument to :func:`isinstance` +and :func:`issubclass`:: + + >>> isinstance(1, int | str) + True + +See :ref:`types-union` and :pep:`604` for more details. (Contributed by Maggie Moss and Philippe Prados in :issue:`41428`.) |