[Python-ideas] Async API
Guido van Rossum
guido at python.org
Thu Oct 25 00:43:27 CEST 2012
On Wed, Oct 24, 2012 at 2:30 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Yury Selivanov wrote:
>> It's not about try..finally nesting, it's about Scheduler being aware
>> that a coroutine is in its 'finally' block and thus shouldn't be
>> at the moment
> It would be a bad idea to make a close() method, or anything else
> that might be needed for cleanup purposes, be a 'yield from' call.
> If it's an ordinary function, it can't be interrupted in the world
> we're talking about, so the PEP 419 problem doesn't apply.
> If I were feeling in a radical mood, I might go as far as suggesting
> that 'yield' and 'yield from' be syntactically forbidden inside
> a finally clause. That would force you to design your cleanup
> code to be safe from interruptions.
What's the problem with just letting the cleanup take as long as it
wants to and do whatever it wants? That's how try/finally works in
regular Python code.
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas