Iterate from 2nd element of a huge list
no.email at nospam.invalid
Wed Feb 1 04:25:05 EST 2012
Paulo da Silva <p_s_d_a_s_i_l_v_a at netcabo.pt> writes:
> for el in mylist[1:]:
> This way mylist is almost duplicated, isn't it?
I think it's cleanest to use itertools.islice to get the big sublist
from itertools import islice
for el in islice(mylist, 1, None):
The islice has a small, constant amount of storage overhead instead of
duplicating almost the whole list.
More information about the Python-list