Massimo Caliman
by Massimo Caliman
~1 min read

Categories

  • Python

Has it ever occurred to you to write something like this?

swap(x,y) 

but just because if you are maniacal about code readability and write yourself a random swap method every time… and you don’t like to drown in 100+ lines of code something like this

temp = x ;
x= y;
y= temp;

with Pyhton just do

x,y = y,x, 

magic, no? The beauty of tuples.