Skip to content

Commit dca8489

Browse files
authored
Add Tuples of variable size to the cheat sheet (#8364)
1 parent d6c2c01 commit dca8489

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/source/cheat_sheet_py3.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ Built-in types
6565
# For mappings, we need the types of both keys and values
6666
x: Dict[str, float] = {'field': 2.0}
6767
68-
# For tuples, we specify the types of all the elements
68+
# For tuples of fixed size, we specify the types of all the elements
6969
x: Tuple[int, str, float] = (3, "yes", 7.5)
70+
71+
# For tuples of variable size, we use one type and ellipsis
72+
x: Tuple[int, ...] = (1, 2, 3)
7073
7174
# Use Optional[] for values that could be None
7275
x: Optional[str] = some_function()

0 commit comments

Comments
 (0)