Essentially, the tuple (m1,m2)
is recieving the values in the tuple (x,m1)
. After the statement m1
will have the old value of x
and m2
will have the old value of m1
. Example:
>>> x = 2
>>> y = 3
>>> z = 4
>>> x,y = y,z
>>> x
3
>>> y
4
The tuple (x,m1)
is created before any assignments are made. As a result, this syntax is often used for swapping two variables. For example, x,y = y,x
will swap the values in x
and y
.