8000 Document empty tuple syntax (#4313) · python/mypy@71332d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 71332d5

Browse files
emmatypinggvanrossum
authored andcommitted
Document empty tuple syntax (#4313)
Fixes #4211.
1 parent 540dc57 commit 71332d5

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

docs/source/builtin_types.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Type Description
1313
``bytes`` 8-bit string
1414
``object`` an arbitrary object (``object`` is the common base class)
1515
``List[str]`` list of ``str`` objects
16+
``Tuple[int, int]`` tuple of two ``int``s (``Tuple[()]`` is the empty tuple)
17+
``Tuple[int, ...]`` tuple of an arbitrary number of ``int`` objects
1618
``Dict[str, int]`` dictionary from ``str`` keys to ``int`` values
1719
``Iterable[int]`` iterable object containing ints
1820
``Sequence[bool]`` sequence of booleans

docs/source/cheat_sheet.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Built-in types
3333
x = [1] # type: List[int]
3434
x = set([6, 7]) # type: Set[int]
3535
36+
# Empty Tuple types are a bit special
37+
x = () # type: Tuple[()]
38+
3639
# For mappings, we need the types of both keys and values.
3740
x = dict(field=2.0) # type: Dict[str, float]
3841

docs/source/cheat_sheet_py3.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Built-in types
3434
x = [1] # type: List[int]
3535
x = {6, 7} # type: Set[int]
3636
37+
# Empty Tuple types are a bit special
38+
x = () # type: Tuple[()]
39+
3740
# For mappings, we need the types of both keys and values.
3841
x = {'field': 2.0} # type: Dict[str, float]
3942

0 commit comments

Comments
 (0)
0