Pierre <pierre.gaill...@gmail.com> wrote:
> I would like to know if it is possible to define a loop in a lambda
> function....

It is if you can easily replace the for loop with a call to map():

>>> s_minus_1 = lambda s: map(lambda x: x-1, s)
>>> test = range(1, 100, 10)
>>> test
[1, 11, 21, 31, 41, 51, 61, 71, 81, 91]
>>> s_minus_1(test)
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to