Günter Rote added the comment: Sorry, that was my misinterpretation of what happened. I had been stumbling over an old program I had written, but apparently it works because the while-loop is inside a generator function, and the StopIteration is simply passed on.
Here is a small demonstration example: >>> def f(): ... for x in range(5): ... yield x ... >>> def g(): ... h=f() ... while True: ... yield next(h)+100 ... yield next(h) ... >>> list(g()) [100, 1, 102, 3, 104] (I am beginning to wonder whether this program will be adversely affected by PEP 479 -- Change StopIteration handling inside generators.) ---------- stage: -> resolved status: open -> closed versions: +Python 3.4 -Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31156> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com