[Python-ideas] Revised**12 PEP on Yield-From
greg.ewing at canterbury.ac.nz
Thu Apr 23 03:23:58 CEST 2009
Jacob Holm wrote:
> In other words, the ValueError in the following example is swallowed by
> >>> def foo():
> ... yield 'bar'
> ... raise ValueError('baz')
> >>> g = foo()
> >>> g.next()
> >>> g.close()
No, g never raises a ValueError here, because the raise
statement is not reached.
You need to wrap the yield in a try-except to catch the
More information about the Python-ideas