Message300011
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.) |
|
Date |
User |
Action |
Args |
2017-08-09 14:22:02 | Günter Rote | set | recipients:
+ Günter Rote, r.david.murray, docs@python |
2017-08-09 14:22:02 | Günter Rote | set | messageid: <1502288522.63.0.578433190572.issue31156@psf.upfronthosting.co.za> |
2017-08-09 14:22:02 | Günter Rote | link | issue31156 messages |
2017-08-09 14:22:02 | Günter Rote | create | |
|