A question about the posibility of raise-yield in Python

John Nagle nagle at animats.com
Wed Jun 30 12:48:03 EDT 2010


On 6/30/2010 12:13 AM, Дамјан Георгиевски wrote:
>> A 'raise-yield' expression would break the flow of a program just like
>> an exception, going up the call stack until it would be handled, but
>> also like yield it would be possible to continue the flow of the
>> program from where it was raise-yield-ed.

     Bad idea.  Continuing after an exception is generally troublesome.
This was discussed during the design phase of Ada, and rejected.
Since then, it's been accepted that continuing after an exception
is a terrible idea.  The stack has already been unwound, for example.

     What you want, in in the situation you describe, is an optional
callback, to be called in case of a fixable problem. Then the
caller gets control, but without stack unwinding.

				John Nagle



More information about the Python-list mailing list