Skip to content

Commit 37fd9f7

Browse files
keysmashesmiss-islington
authored andcommitted
[3.7] bpo-37814: Document the empty tuple type annotation syntax (GH-15208) (GH-15262)
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 8a784af) Co-authored-by: Josh Holland <[email protected]> https://bugs.python.org/issue37814 Automerge-Triggered-By: @gvanrossum
1 parent 9286677 commit 37fd9f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/library/typing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,8 @@ The module defines the following classes, functions and decorators:
10561056
.. data:: Tuple
10571057

10581058
Tuple type; ``Tuple[X, Y]`` is the type of a tuple of two items
1059-
with the first item of type X and the second of type Y.
1059+
with the first item of type X and the second of type Y. The type of
1060+
the empty tuple can be written as ``Tuple[()]``.
10601061

10611062
Example: ``Tuple[T1, T2]`` is a tuple of two elements corresponding
10621063
to type variables T1 and T2. ``Tuple[int, float, str]`` is a tuple

0 commit comments

Comments
 (0)