diff --git a/docs/source/builtin_types.rst b/docs/source/builtin_types.rst index 4426df73868c..e41c5db6fbf5 100644 --- a/docs/source/builtin_types.rst +++ b/docs/source/builtin_types.rst @@ -13,6 +13,8 @@ Type Description ``bytes`` 8-bit string ``object`` an arbitrary object (``object`` is the common base class) ``List[str]`` list of ``str`` objects +``Tuple[int, int]`` tuple of two ``int``s (``Tuple[()]`` is the empty tuple) +``Tuple[int, ...]`` tuple of an arbitrary number of ``int`` objects ``Dict[str, int]`` dictionary from ``str`` keys to ``int`` values ``Iterable[int]`` iterable object containing ints ``Sequence[bool]`` sequence of booleans diff --git a/docs/source/cheat_sheet.rst b/docs/source/cheat_sheet.rst index a1cdb980df07..590820c943af 100644 --- a/docs/source/cheat_sheet.rst +++ b/docs/source/cheat_sheet.rst @@ -33,6 +33,9 @@ Built-in types x = [1] # type: List[int] x = set([6, 7]) # type: Set[int] + # Empty Tuple types are a bit special + x = () # type: Tuple[()] + # For mappings, we need the types of both keys and values. x = dict(field=2.0) # type: Dict[str, float] diff --git a/docs/source/cheat_sheet_py3.rst b/docs/source/cheat_sheet_py3.rst index 09eab13d4bf4..86280257a8b4 100644 --- a/docs/source/cheat_sheet_py3.rst +++ b/docs/source/cheat_sheet_py3.rst @@ -34,6 +34,9 @@ Built-in types x = [1] # type: List[int] x = {6, 7} # type: Set[int] + # Empty Tuple types are a bit special + x = () # type: Tuple[()] + # For mappings, we need the types of both keys and values. x = {'field': 2.0} # type: Dict[str, float]