[Python-ideas] Revised**12 PEP on Yield-From

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 24 00:25:27 CEST 2009


Erik Groeneveld wrote:

> and knowing that close() raises a RuntimeError when a generator
> ignores GeneratorExit, I have:
> 
>                     try:
>                         generator.close()
>                     except RuntimeError:
>                         pass
>                     raise GeneratorExit

No, you shouldn't be doing that -- just let the
RuntimError propagate. The "otherwise" refers to the
case where the close() call completes normally
without raising any exception.

-- 
Greg



More information about the Python-ideas mailing list