On Tue, Oct 6, 2020 at 10:14 AM Marco Sulla <Marco.Sulla.Python@gmail.com> 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?

Is this. big deal? maybe not -- islice is written in C, and pretty darn fast, but there is a missing efficiency here, which could be addressed by either providing access to set the iterator "counter", as proposed, or by providing a view object that could be a slice without copying.

-CHB



 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/QZ5QL3HNNDJYV67RPVATVDRD5R63AOUM/
Code of Conduct: http://python.org/psf/codeofconduct/


--
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython