Lambda function array manipulation

by jenny on 22 April 2008 - 04:28pm in

A fun bit of code brought to my attention by Lih:

>>> l = [1,2,3,4]
>>> l
[1, 2, 3, 4]
>>> l2 = [ x+1 for x in l ]
>>> l2
[2, 3, 4, 5]