From the documentation, if we want to implement a non-blocking delay we should implement await asyncio.sleep(delay)
because time.sleep(delay)
is blocking in nature. But from what I could understand, it is the await
keyword that cedes control of the thread to do something else while the function f()
following the keyword i.e. await f()
finishes its calculations.
So if we need the await
keyword in order for asyncio.sleep(delay)
to be non-blocking, what is the difference with its counterpart time.sleep(delay)
if both are not awaited for?
Also, can't we reach the same result by preceding both sleep functions with a await
keyword?