Message302843
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). |
|
Date |
User |
Action |
Args |
2017-09-24 10:01:19 | rhettinger | set | recipients:
+ rhettinger, tim.peters, serhiy.storchaka, mgilson, Matt Gilson |
2017-09-24 10:01:18 | rhettinger | set | messageid: <1506247278.99.0.692829015407.issue30346@psf.upfronthosting.co.za> |
2017-09-24 10:01:18 | rhettinger | link | issue30346 messages |
2017-09-24 10:01:18 | rhettinger | create | |
|