Although the definition of assignment implies that overlaps between the left-hand side and the right-hand side are ‘simultaneous’ (for example a, b = b, a swaps two variables), overlaps within the collection of assigned-to variables occur left-to-right.
>>> a, b
(2, 3)
>>> a, b = b, a
>>> a, b
(3, 2)
>>> x = [0, 1]
>>> i = 0
>>> i, x[i] = 1, 2
>>> x
[0, 2]
read more
- Assignment statements¶