On Tue, Oct 6, 2020 at 7:21 PM Christopher Barker <[email protected]> wrote:
> > > On Tue, Oct 6, 2020 at 10:14 AM Marco Sulla <[email protected]> > wrote: > >> What I do not understand is why you need to use the iterator instead >> of using the iterable itself. This way you can jump to whatever >> position without slicing. >> > > if you want the Nth item, that's easy, yes. > > 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? > ```python for i in range(start, stop): x = lst[i] process(x) ``` The only problem is that there's slightly more execution in Python-land than in C-land, but that only matters if `process(x)` does very little and you're really concerned about performance. I can see how the proposal could be useful but only in very limited use cases.
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/UQ327GHUIHT46AZU73KM562NFEGNGYUQ/ Code of Conduct: http://python.org/psf/codeofconduct/
