In an assignment using the '
=' operator the right hand side expression is evaluated first. This provides a convenient way to swap the values of two variables using tuples:
a, b = b, a
Here, the righthand side is packed into a tuple object, which is then unpacked into the variables assigned on the lefthand side. This is a more convenient than using a temporary variable:
t = a a = b b = t