[docs] [issue34701] Asyncio documentation for recursive coroutines is lacking

Yury Selivanov report at bugs.python.org
Sun Sep 16 00:09:06 EDT 2018


Yury Selivanov <yselivanov at gmail.com> added the comment:

The issue here is not the recursion,  but rather about the fact that coroutines should actually await on IO or other activity in order for the event loop to run them cooperatively.  E.g.

   async def foo():
        await foo()

doesn't really do anything expect calling itself, whereas

   async def foo():
        await sleep(0)
        await foo()

is asking the event loop to sleep for a moment and then recurses into itself.

I'm OK with better clarifying this in the asyncio-dev.rst file.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34701>
_______________________________________


More information about the docs mailing list