Message358621
Thanks for raising the very interesting question!
Sorry, my English is bad; I cannot help with docs too much.
Anyway, technically an awaited coroutine *can* be suspended but the suspension is not always necessary. The most deep awaited function decides.
For example, if you want to read 16 bytes from a stream and these bytes are already fetched there is no suspension at this point (at least libraries are designed in this way usually).
Also, technical speaking about awaits is hard without telling that a coroutine is a specialized version of generator object with (partially) overlapped methods and properties, e.g. send() and throw().
To run a coroutine you need a framework which calls these methods depending on the framework rules, the rules for asyncio are different from trio.
Not sure how long should be the section but looking on `yield expressions` https://docs.python.org/3/reference/expressions.html#yield-expressions above I expect that awaits can take two-three times longer. |
|
Date |
User |
Action |
Args |
2019-12-18 11:10:19 | asvetlov | set | recipients:
+ asvetlov, njs, yselivanov, aeros |
2019-12-18 11:10:19 | asvetlov | set | messageid: <1576667419.88.0.221193895617.issue39085@roundup.psfhosted.org> |
2019-12-18 11:10:19 | asvetlov | link | issue39085 messages |
2019-12-18 11:10:19 | asvetlov | create | |
|