Steven D'Aprano wrote: [snip] > The important thing to notice is that alist[1:] makes a copy. What if the > list has millions of items and duplicating it is expensive? What do people > do in that case? > > Are there better or more Pythonic alternatives to this obvious C-like > idiom? > > for i in range(1, len(alist)): > x = alist[i]
for x in itertools.islice(alist, 1, len(alist)): HTH Ziga -- http://mail.python.org/mailman/listinfo/python-list