asyncio - run coroutine in the background

Marko Rauhamaa marko at
Mon Feb 15 01:54:38 EST 2016

"Frank Millman" <frank at>:

> Using asyncio, there are times when I want to execute a coroutine which
> is time-consuming. I do not need the result immediately, and I do not
> want to block the current task, so I want to run it in the background.

You can't run code "in the background" using asyncio. Coroutines perform
cooperative multitasking in a single thread on a single CPU.

Parallel processing requires the use of threads or, often preferably,

To put it in another way, never run time-consuming code in asyncio.


More information about the Python-list mailing list