bpo-37814: Document the empty tuple type annotation syntax (GH-15208)

https://bugs.python.org/issue37814:

> The empty tuple syntax in type annotations, `Tuple[()]`, is not obvious from the examples given in the documentation (I naively expected `Tuple[]` to work); it has been documented in PEP 484 and in mypy, but not in the documentation for the typing module.

https://bugs.python.org/issue37814
(cherry picked from commit 8a784af750)

Co-authored-by: Josh Holland <anowlcalledjosh@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-08-13 12:12:55 -07:00 committed by GitHub
parent ee98951252
commit 6ad902a088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1245,7 +1245,8 @@ The module defines the following classes, functions and decorators:
.. data:: Tuple .. data:: Tuple
Tuple type; ``Tuple[X, Y]`` is the type of a tuple of two items Tuple type; ``Tuple[X, Y]`` is the type of a tuple of two items
with the first item of type X and the second of type Y. with the first item of type X and the second of type Y. The type of
the empty tuple can be written as ``Tuple[()]``.
Example: ``Tuple[T1, T2]`` is a tuple of two elements corresponding Example: ``Tuple[T1, T2]`` is a tuple of two elements corresponding
to type variables T1 and T2. ``Tuple[int, float, str]`` is a tuple to type variables T1 and T2. ``Tuple[int, float, str]`` is a tuple