Guido van Rossum, in his speech in 2014 on Tulip/Asyncio shows the slide:
Tasks vs coroutines
Compare:
- res = yield from some_coroutine(...)
- res = yield from Task(some_coroutine(...))
Task can make progress without waiting for it
- As log as you wait for something else
- i.e. yield from
And I'm completely missing the point.
From my point of view both constructs are identical:
In case of bare coroutine - It gets scheduled, so the task is created anyways, because scheduler operates with Tasks, then coroutine caller coroutine is suspended until callee is done and then becomes free to continue execution.
In case of Task
- All the same - new task is schduled and caller coroutine waits for its completion.
What is the difference in the way that code executed in both cases and what impact it has that developer should consider in practice?
p.s.
Links to authoritative sources (GvR, PEPs, docs, core devs notes) will be very appreciated.