[Python-ideas] Async API
yselivanov.ml at gmail.com
Thu Oct 25 06:37:57 CEST 2012
On 2012-10-24, at 10:51 PM, Guido van Rossum <guido at python.org> wrote:
> On Wed, Oct 24, 2012 at 7:28 PM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
>> On 2012-10-24, at 9:34 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>>> (Note that in the face of preemption, I don't think it's possible
>>> to solve this problem completely without language support, because
>>> there will always be a small window of opportunity between
>>> entering the finally clause and getting into the with-statement
>>> or whatever that you're using to block asynchronous signals.)
>> In my experience, though, broken finally blocks due to interruption
>> by a signal is a very rare thing (again, that maybe different for
>> someone else.)
> We're far from our starting point: in a the yield-from (or yield)
> world, there are no truly async interrupts, but anything that yields
> may be interrupted, if we decide to implement timeouts by throwing an
> exception into the generator (which seems the logical thing to do).
> The with-statement can deal with this fine (there's no yield between
> entering the finally and entering the with-block) but making the
> cleanup into its own task (like Steve proposed) sounds fine too.
> In any case this sounds like something that each framework should
> decide for itself.
BTW, is there a way of adding a read-only property to generator objects -
'in_finally'? Will it actually slow down things?
More information about the Python-ideas