[Python-Dev] Combining the best of PEP 288 and PEP 325: generatorexceptions and cleanup

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 19 05:31:23 CEST 2005


Phillip J. Eby wrote:
> My use case for throw() calls for the latter option; i.e., the exception is 
> raised by the yield expression at the resumption point.  Keep in mind that 
> if the exception passes out of the generator, the throw() call will show in 
> the traceback anyway.  It's unlikely the generator itself will inspect the 
> traceback and need to see the throw() call as if it were nested.

There mightn't be much choice anyway. If the frame making
the call to throw() were to be made the starting point for
the traceback, and the exception propagated back to the
throw, something would try to put the same frame in the
traceback twice, which can't work since it's a linked
list.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+


More information about the Python-Dev mailing list