Tasks: Scheduled Coroutines
A Task wraps a coroutine and schedules it to run on the event loop. Unlike plain coroutines, Tasks start executing immediately:
Learning Objectives
Lesson Outline
A Task wraps a coroutine and schedules it to run on the event loop. Unlike plain coroutines, Tasks start executing immediately:
| Coroutine | Task |
|---|---|
| Must be awaited to run | Starts running immediately |
| Can't be cancelled | Can be cancelled |
| No status tracking | Has done(), cancelled() methods |
| Runs inline | Runs concurrently |