diff options
author | Josh Holland <anowlcalledjosh@gmail.com> | 2019-08-13 19:05:09 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-08-13 19:05:09 (GMT) |
commit | 8a784af750fa82c8355903309e5089eb2b60c16b (patch) | |
tree | dbce7a5303ae01fdf558bd1a8523df26bc17da5a | |
parent | 1ac2a83f30312976502fda042db5ce18d10ceec2 (diff) | |
download | cpython-8a784af750fa82c8355903309e5089eb2b60c16b.zip cpython-8a784af750fa82c8355903309e5089eb2b60c16b.tar.gz cpython-8a784af750fa82c8355903309e5089eb2b60c16b.tar.bz2 |
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
-rw-r--r-- | Doc/library/typing.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index d2dd03d..12efde1 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1245,7 +1245,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 |