Raymond Hettinger added the comment: Go ahead with PR 1569 to exhaust the inner iterator when the outer iterator advances.
Rationale: The OP expected the inner iterator to be exhausted. That is also what the PyPy team originally implemented and it is what I would have expected. Also, there are some loose analogies elsewhere in the language. Raising StopIteration is what next(somefileobject) does when there is a seek-to-end between next() calls. A list iterator raises StopIteration when there is a del somelist[:] between next() calls. When zip(it1, it2) terminates on the shortest input, it leaves the other iterator alive, allowing it to run and terminally normally with StopIteration. And though I don't have a use case for it, I would expect that next(inner_iterator, default_value) would return a value from the input stream or the default value but would not fail with a RuntimeError (this would apply to islice() as well). ---------- assignee: rhettinger -> serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue30346> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com