Efficiently iterating over part of a list

Paul Rubin http
Fri Oct 13 06:20:31 EDT 2006


Steven D'Aprano <steve at REMOVEME.cybersource.com.au> writes:
> for i in range(1, len(alist)):
>     x = alist[i]

a2 = iter(alist)
a2.next()      # throw away first element
for x in a2:
  ...



More information about the Python-list mailing list