[Python-ideas] Async API

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Oct 30 01:06:29 CET 2012


Yury Selivanov wrote:
> Because scheduler, when it is deciding to interrupt a coroutine or not, 
> should only question whether that particular coroutine is in its finally, 
> and not the one which called it.

So given this:

    def c1():
       try:
          something()
       finally:
          yield from c2()
          very_important_cleanup()

    def c2():
       yield from block() # 1

it should be okay to interrupt at point 1, even though
it will prevent very_important_cleanup() from being done?

That doesn't seem right to me.

-- 
Greg



More information about the Python-ideas mailing list