3 ms·
The tuple notation is one of those places where the obvious way is a distraction. A non-empty tuple doesn't need the ()s - it's the "," which makes the tuple! T
by eesmith 7y ago
The tuple notation is one of those places where the obvious way is a distraction. A non-empty tuple doesn't need the ()s - it's the "," which makes the tuple! The following two are equivalent:
x = 1,
x = (1,)
Of course, then there's no way to express the empty tuple using commas, which is where () comes in.
Using (a,) is the belts-and-suspenders way of saying "this is a 1 element tuple".