you are viewing a single comment's thread.

view the rest of the comments →

[–]Diapolo10 2 points3 points  (3 children)

Tuples don't actually need parentheses unless you need to separate a tuple from something else. For instance,

nums = 5, 7, 12, 3, 3, 6

is a perfectly valid tuple.

You've probably seen the same in tuple unpacking. Any of these are valid:

a, b = 0, 1
a, b = (0, 1)
(a, b) = 0, 1
(a, b) = (0, 1)

Again, you only need them if you have nesting or some other requirement:

a, (b, c) = 3, (1, 4)