asyncio - run coroutine in the background
frank at chagford.com
Tue Feb 16 08:52:01 EST 2016
"Kevin Conway" wrote in message
news:CAKF=+dim8wzPRvm86_V2W5-XSopCcHvgm0Hy8r4xeHDYzy_P4w at mail.gmail.com...
> If you're handling coroutines there is an asyncio facility for "background
> tasks". The ensure_future  will take a coroutine, attach it to a Task,
> and return a future to you that resolves when the coroutine is complete.
> The coroutine you schedule with that function will not cause your current
> coroutine to wait unless you await the future it returns.
Thank you Kevin!
That works perfectly, and is much neater than my effort.
More information about the Python-list