Pull-Request has been rebased
Now that pkg is a generator, this may always evaluate to True. Can you test that and see?
pkg
True
Same here.. I'm not sure data will ever be False-y here.
data
False
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.
yield from
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 future
result = yield from future
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.
result = await coroutine
result = yield from coroutine
Awesome. Thanks for the clarification. :+1: here.
Pull-Request has been merged by pingou