Recipe request: asyncio "spin off coroutine"
Frank Millman
frank at chagford.com
Thu Dec 15 02:19:03 EST 2016
"Marko Rauhamaa" wrote in message news:87vaulitxe.fsf at elektro.pacujo.net...
>
> "Frank Millman" <frank at chagford.com>:
>
> > I changed 'await self.close()', to
> > 'asyncio.ensure_future(self.close())'.
> >
> > Problem solved.
>
> A nice insight.
>
> However, shouldn't somebody somewhere in your code be keeping track of
> the returned task?
>
I don't know. What is the worst that could happen?
My way of looking at it is that it is similar to setTimeout() in javascript.
I am requesting that the enclosed function/coroutine be scheduled for
execution at the next available opportunity in the event loop. In
javascript, I don't keep track of it, I just assume that it will be executed
at some point. Is it not reasonable to do the same here?
Frank
More information about the Python-list
mailing list