This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Matt Gilson, mgilson, rhettinger, serhiy.storchaka, tim.peters
Date 2017-09-24.10:01:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506247278.99.0.692829015407.issue30346@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2017-09-24 10:01:19rhettingersetrecipients: + rhettinger, tim.peters, serhiy.storchaka, mgilson, Matt Gilson
2017-09-24 10:01:18rhettingersetmessageid: <1506247278.99.0.692829015407.issue30346@psf.upfronthosting.co.za>
2017-09-24 10:01:18rhettingerlinkissue30346 messages
2017-09-24 10:01:18rhettingercreate