Michal Wallace <[EMAIL PROTECTED]> wrote: > It seems that exception handlers get tied to > subroutines when they're created, not when > they're actually used. For example:
> ## this works: > try: > f = make_function() > f.die() # raise some error > except: > pass > > ## this does not work: > f = make_function() > try: > f.die() # raise some error > except: > pass When you create the coroutine in "make_function" (2nd version) it doesn't have the exception handler in its context. Calling the generator therefor hasn't the eception handler, the exception isn't caught then. I can't see a way to update the context of coroutines created before the exception handler was there. Or coroutines shouldn't swap the control stack - I don't know. leo