In [1]:
def swap(x, y):
    t = x
    x = y
    y = t
    return x, y

In [2]:
swap(10, 20)


Out[2]:
(20, 10)

In [3]:
def swap(x, y):
    y, x = x, y
    return x, y

In [4]:
swap(10, 20)


Out[4]:
(20, 10)

It does not have to be just integers


In [5]:
swap('hello', {i: i*i for i in range(3)})


Out[5]:
({0: 0, 1: 1, 2: 4}, 'hello')