[3.10] bpo-46120: State that | is preferred over Union (GH-30222) (GH-30250)

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
(cherry picked from commit 1b30660c3b)


Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Automerge-Triggered-By: GH:gpshead
This commit is contained in:
Miss Islington (bot) 2021-12-29 03:45:14 -08:00 committed by GitHub
parent 576e38f9db
commit ed1671ced7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -625,7 +625,7 @@ These can be used as types in annotations using ``[]``, each having a unique syn
Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or Y.
To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | str``. Details:
To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | str``. Using that shorthand is recommended. Details:
* The arguments must be types and there must be at least one.

View file

@ -0,0 +1 @@
State that ``|`` is preferred for readability over ``Union`` in the :mod:`typing` docs.