Guido van Rossum, in his speech in 2014 on Tulip/Asyncio shows the slide:
Tasks vs coroutines
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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…