[Python-checkins] [3.7] bpo-37814: Document the empty tuple type annotation syntax (GH-15208) (GH-15262)

Miss Islington (bot) webhook-mailer at python.org
Tue Aug 13 15:26:20 EDT 2019


https://github.com/python/cpython/commit/37fd9f73e2fa439554977cfba427bf94c1fedb6b
commit: 37fd9f73e2fa439554977cfba427bf94c1fedb6b
branch: 3.7
author: Josh Holland <anowlcalledjosh at gmail.com>
committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
date: 2019-08-13T12:26:12-07:00
summary:

[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 8a784af750fa82c8355903309e5089eb2b60c16b)

Co-authored-by: Josh Holland <anowlcalledjosh at gmail.com>





https://bugs.python.org/issue37814



Automerge-Triggered-By: @gvanrossum

files:
M Doc/library/typing.rst

diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index 5adc81c1e3c8..c0b048cb2bd3 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -1056,7 +1056,8 @@ The module defines the following classes, functions and decorators:
 .. data:: Tuple
 
    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
    to type variables T1 and T2.  ``Tuple[int, float, str]`` is a tuple



More information about the Python-checkins mailing list