diff options
-rw-r--r-- | Doc/library/typing.rst | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Documentation/2021-12-21-12-45-57.bpo-46120.PE0DmJ.rst | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 727941b..08b59d8 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -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. diff --git a/Misc/NEWS.d/next/Documentation/2021-12-21-12-45-57.bpo-46120.PE0DmJ.rst b/Misc/NEWS.d/next/Documentation/2021-12-21-12-45-57.bpo-46120.PE0DmJ.rst new file mode 100644 index 0000000..17f6747 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2021-12-21-12-45-57.bpo-46120.PE0DmJ.rst @@ -0,0 +1 @@ +State that ``|`` is preferred for readability over ``Union`` in the :mod:`typing` docs. |