#31 Chain the method as coroutines to make the process more asynchronous
Merged by pingou. Opened by pingou.
more_asyncio  into  master

Download 31.patch
no initial comment

Pull-Request has been rebased

Now that pkg is a generator, this may always evaluate to True. Can you test that and see?

Same here.. I'm not sure data will ever be False-y here.

There's a high chance that my comments are incorrect (this is new territory).. but I'd be curious to know, if you could check please.

Looks good to me!

@ralph, pkg is not a generator in that context, the yield from simply gets the return value of the coroutine after yielding control back to the main loop first.

From https://docs.python.org/3/library/asyncio-task.html

Things a coroutine can do:

result = await future or result = yield from future – suspends the coroutine until the future is done, then returns the future’s result, or raises an exception, which will be propagated. (If the future is cancelled, it will raise a CancelledError exception.) Note that tasks are futures, and everything said about futures also applies to tasks.

result = await coroutine or result = yield from coroutine – wait for another coroutine to produce a result (or raise an exception, which will be propagated). The coroutine expression must be a call to another coroutine.

Awesome. Thanks for the clarification. :+1: here.

Pull-Request has been rebased

Pull-Request has been merged by pingou

Metadata