Consider this function getPos() which returns a tuple. What is the difference between the two following assignments? Somewhere I saw an example where the first assignment was used but when I just tried the second one, I was surprised it also worked. So, is there really a difference, or does Python just figure out that the left-hand part should be a tuple?
def getPos():
return (1, 1)
(x, y) = getPos() # First assignment
x, y = getPos() # Second assignment
Read about tuples:
So parenthesis does not make a tuple a tuple. The commas do it.
Parenthesis are only needed if you have weird nested structures: