In Python, we need an await
keyword before each coroutine object to have it called by the event loop. But when we put await
, it makes the call blocking. It follows that we end up doing the same thing as we do in the blocking fashion. What is the point of having such a use?
https://www.aeracode.org/2018/02/19/python-async-simplified/
await
makes the call locally blocking, but the "wait" is transmitted through the async function (which is itself awaited), such that when it reaches the reactor the entire task can be moved to a waitlist and an other can be run instead.
Furthermore you do not need an await
, you could also spawn
the coroutine (to a separate task, which you may or may not wait on), or use one of the "future combinators" (asyncio.gather
, asyncio.wait
, ...) to run it concurrently with others.