Python separates the right-hand side expression from the left-hand side assignment. First the right-hand side is evaluated, and the result is stored on the stack, and then the left-hand side names are assigned using opcodes that take values from the stack again.
>>> import dis
>>> def foo(a, b):
... a, b = b, a
...
>>> dis.dis(foo)
2 0 LOAD_FAST 1 (b)
3 LOAD_FAST 0 (a)
6 ROT_TWO
7 STORE_FAST 0 (a)
10 STORE_FAST 1 (b)
13 LOAD_CONST 0 (None)
16 RETURN_VALUE
It works like any other unpacking assignment.
First, a tuple consisting of the values of b and a is created. Then this tuple is unpacked into a and b, effectively swapping them.
>>> a=5
>>> b=6
>>> a,b = b,a
>>> a
6
>>> b
5
Now using this property, Fibonacci Sequence are generated.
Source: https://stackoverflow.com/a/21047622/1112163