Where is the difference when I write something on one line, seperated by a ,
and on two lines. Apparently I do not understand the difference, because I though t
This is because of Python's tuple unpacking. In the first one, Python collects the values on the right, makes them a tuple, then assigns the values of the tuple individually to the names on the left. So, if a == 1 and b == 2:
a, b = b, a + b
=> a, b = (2, 3)
=> a = 2, b = 3
But in the second example, it's normal assignment:
a = b
=> a = 2
b = a + b
=> b = 4