Re: for v in l:

2007-01-16 Thread Gert Cuykens
ok thx this was just what i was looking for http://docs.python.org/tut/node7.html#SECTION00760 -- http://mail.python.org/mailman/listinfo/python-list

Re: for v in l:

2007-01-16 Thread Peter Otten
Gert Cuykens wrote: > is there a other way then this to loop trough a list and change the values > > i=-1 > for v in l: > i=i+1 > l[i]=v+x > > something like > > for v in l: > l[v]=l[v]+

Re: for v in l:

2007-01-15 Thread Gabriel Genellina
At Monday 15/1/2007 21:48, Gert Cuykens wrote: is there a other way then this to loop trough a list and change the values i=-1 for v in l: i=i+1 l[i]=v+x for i,value in enumerate(my_list): my_list[i] = compute_new_value(value) See the

Re: for v in l:

2007-01-15 Thread Nanjundi
Try: l = [i+x for i in l] OR l = map(lambda i: i+x, l) -N Gert Cuykens wrote: > is there a other way then this to loop trough a list and change the values > > i=-1 > for v in l: > i=i+1 > l[i]=v+x > > something like

for v in l:

2007-01-15 Thread Gert Cuykens
is there a other way then this to loop trough a list and change the values i=-1 for v in l: i=i+1 l[i]=v+x something like for v in l: l[v]=l[v]+x -- http://mail.python.org/mailman/listinfo/python-list