Published:
Python evaluates expressions from left to right. Notice that while evaluating an assignment, the right-hand side is evaluated before the left-hand side. http://docs.python.org/2/reference/expressions.html#evaluation-order That means to swap values from a to b and viceversa the following expression is correct a,b = b,a :