On Tue, Oct 6, 2020, 1:21 PM Christopher Barker

> if you want to iterate through items N to the end, then how do you do that
> without either iterating through the first N and throwing them away, or
> making a slice, which copies the rest of the sequence?
>

it = (lst[i] for i in range(N, len(lst)))

I haven't benchmarked whether this is faster than islice. It might depend
on how many you wind up consuming.

It's slightly cumbersome to write, I suppose. But it also seems like
something one RARELY needs.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/F7N5H6CAUJM5BICC4BEEWQDNIDGN2RTR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to