@@ -12,7 +12,7 @@ You might be curious about some key :mod:`!asyncio` concepts.
1212You'll be comfortably able to answer these questions by the end of this
1313article:
1414
15- - What's happening behind the scenes when an object is `` await `` \ ed ?
15+ - What's happening behind the scenes when an object is awaited ?
1616- How does :mod: `!asyncio ` differentiate between a task which doesn't need
1717 CPU-time (such as a network request or file read) as opposed to a task that
1818 does (such as computing n-factorial)?
@@ -201,15 +201,15 @@ different ways::
201201 await task
202202 await coroutine
203203
204- Unfortunately, it does matter which type of object is `` await `` \ ed .
204+ Unfortunately, it does matter which type of object is awaited .
205205
206- `` await `` \ ing a task will cede control from the current task or coroutine to
206+ awaiting a task will cede control from the current task or coroutine to
207207the event loop.
208208In the process of relinquishing control, the task that's giving up control
209- adds a callback to the `` await `` \ ed task's list of callbacks indicating it
210- should resume the current task/coroutine when it (the `` await `` \ ed one)
209+ adds a callback to the awaited task's list of callbacks indicating it
210+ should resume the current task/coroutine when it (the awaited one)
211211finishes.
212- In other words, when that `` await `` \ ed task finishes, the original task is
212+ In other words, when that awaited task finishes, the original task is
213213added back to the event loops queue.
214214
215215This is a basic, yet reliable mental model.
@@ -218,7 +218,7 @@ In part 2, we'll walk through the details that make this possible.
218218
219219**Unlike tasks, awaiting a coroutine does not hand control back to the event
220220loop! **
221- Wrapping a coroutine in a task first, then `` await `` \ ing that would cede
221+ Wrapping a coroutine in a task first, then awaiting that would cede
222222control.
223223The behavior of ``await coroutine `` is effectively the same as invoking a
224224regular, synchronous Python function.
@@ -243,7 +243,7 @@ Consider this program::
243243
244244The first statement in the coroutine ``main() `` creates ``task_b `` and places
245245it on the event loop's queue.
246- Then, ``coro_a() `` is repeatedly `` await `` \ ed . Control never cedes to the
246+ Then, ``coro_a() `` is repeatedly awaited . Control never cedes to the
247247event loop which is why we see the output of all three ``coro_a() ``
248248invocations before ``coro_b() ``'s output:
249249
@@ -404,7 +404,7 @@ We'll go through an example of how you could leverage a future to create your
404404own variant of asynchronous sleep (``async_sleep ``) which mimics
405405:func: `asyncio.sleep `.
406406
407- This snippet puts a few tasks on the event loop's queue and then `` await `` \ s a
407+ This snippet puts a few tasks on the event loop's queue and then awaits a
408408coroutine wrapped in a task: ``async_sleep(3) ``.
409409We want that task to finish only after three seconds have elapsed, but without
410410preventing other tasks from running.
0 commit comments