Thanks Nathaniel, Dima!
On Mon, Dec 10, 2018 at 7:45 PM Nathaniel Smith <n...@pobox.com> wrote: > > Yeah, 'await' makes it *possible* for the function you're calling to return > control to the event loop, but returning is still an explicit action that the > function has to take. > > In asyncio, the only operation that actually returns control to the event > loop is awaiting a Future object. > > In Trio, we make a documented guarantee that all the async functions in the > 'trio' namespace do in fact return control to the event loop (we call this a > "checkpoint"). > > In both cases, the effect is the same: if a function never actually awaits a > Future/calls one of Trio's built-in async functions, either directly or > indirectly, then it won't return to the event loop. > > (And curio actually has a number of primitives that you call with await, and > that do in fact return to the event loop, but that still don't actually let > other tasks run, which I found pretty confusing. This is one of the major > reasons I stopped using curio.) > > -n > > On Mon, Dec 10, 2018, 04:32 Dima Tisnek <dim...@gmail.com wrote: >> >> No, in this case fib(1) is resolved instantly, thus it's caller is resolved >> instantly, thus... >> >> On Mon, 10 Dec 2018 at 9:28 PM, Pradip Caulagi <caul...@gmail.com> wrote: >>> >>> I was wondering if every use of 'await' should return the control to >>> event loop? So in this example - >>> https://gist.github.com/caulagi/3edea8cf734495f2592528a48f99e1d2 - I >>> was hoping I would see 'A', 'B' to be mixed, but I see only 'A' >>> followed by 'B'. What am I missing? I am using Python 3.7.1. >>> >>> How is my example different from >>> https://docs.python.org/3.7/library/asyncio-task.html#asyncio.run? >>> >>> Thanks. >>> _______________________________________________ >>> Async-sig mailing list >>> Async-sig@python.org >>> https://mail.python.org/mailman/listinfo/async-sig >>> Code of Conduct: https://www.python.org/psf/codeofconduct/ >> >> _______________________________________________ >> Async-sig mailing list >> Async-sig@python.org >> https://mail.python.org/mailman/listinfo/async-sig >> Code of Conduct: https://www.python.org/psf/codeofconduct/ _______________________________________________ Async-sig mailing list Async-sig@python.org https://mail.python.org/mailman/listinfo/async-sig Code of Conduct: https://www.python.org/psf/codeofconduct/