Code Like a Pythonista: Idiomatic Python

Swap Values

In other languages:

temp = a
a = b
b = temp

In Python:

b, a = a, b

http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html

© Блог Романа Ворушина