asyncio - run coroutine in the background

Frank Millman frank at
Tue Feb 16 08:52:01 EST 2016

"Kevin Conway"  wrote in message 
news:CAKF=+dim8wzPRvm86_V2W5-XSopCcHvgm0Hy8r4xeHDYzy_P4w at
> If you're handling coroutines there is an asyncio facility for "background
> tasks". The ensure_future [1] 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.
> [1]

Thank you Kevin!

That works perfectly, and is much neater than my effort.


More information about the Python-list mailing list