Iterate from 2nd element of a huge list

Cameron Simpson cs at
Tue Jan 31 21:02:59 EST 2012

On 01Feb2012 01:39, Paulo da Silva <p_s_d_a_s_i_l_v_a at> wrote:
| What is the best way to iterate thru a huge list having the 1st element
| a different process? I.e.:
| process1(mylist[0])
| for el in mylist[1:]:
| 	process2(el)
| This way mylist is almost duplicated, isn't it?


What about (untested):

  for i in xrange(1,len(mylist)):

Cameron Simpson <cs at> DoD#743

The truth is, I will not give myself the trouble to write sense long, for I
would as soon please fools as wise men; because fools are more numerous, and
every prudent man will go with the majority.    - Hugh Henry Brackenridge

More information about the Python-list mailing list