I suspect you will encounter a bit of resistence here, because itertools is about, well, itertors, and designbed to work with arbitrary iterables, and what you are looking for is somnethign optimized for Sequences. Which doesn't mean it couldn't be there.
> Slicing large lists/strings/bytes/tuples is both memory and time inefficient. Exactly. Which is why I'd like to have a "view slice", and or more general sequence view object, as outlined here: https://github.com/PythonCHB/islice-pep/blob/master/pep-xxx-islice.rst and discussed on this list here: https://mail.python.org/archives/list/python-ideas@python.org/message/LEMV3WETPR2B6RXU747TC32EI2E7IRF6/ (from four years ago -- which I only just noticed!) And more recently: https://mail.python.org/archives/list/python-ideas@python.org/message/U35BS5OIDCGTL3PTY4DDOT43V3PN72LQ/ That kinda petered out, with from what I could tell, little (no) interest from any core devs. But this is another motivating use case -- so time to revive it? BTW -- see above, Serhiy Storchak, from four years ago, proposed a "sequence tools" module -- which would address the "problem" of adding things to itertools that are only useful for Sequences. -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ 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/ZFZI2Q5JDWABYBHOUR5QGC4W66GKJKYO/ Code of Conduct: http://python.org/psf/codeofconduct/