bpo-46120: State that | is preferred over Union (GH-30222)

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
This commit is contained in:
Nikita Sobolev 2021-12-25 00:36:09 +03:00 committed by GitHub
parent b8de8b7039
commit 1b30660c3b
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.