On 26 April 2010 23:45, Alan Gauld <[email protected]> wrote: > > "C M Caine" <[email protected]> wrote >> >> My intention now is to modify list contents in the following fashion: >> >> for index, value in enumerate(L): >> L[0] = some_func(value) > > I think you mean: > L[index] = some_func(value)
Yes, I do >> Is this the standard method? > > Or use a List copmprehension. > > L = [some_func(value) for value in L] > > I'd say nowadays that the comprehension was most common. > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.alan-g.me.uk/ Thanks, I can see why the comprehensions are more popular. Colin _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
