Skip to content

Commit 22dd833

Browse files
committed
Improve English phrasing in asyncio task docs.
1 parent f8c111d commit 22dd833

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Doc/library/asyncio-task.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -319,18 +319,18 @@ Task
319319
Schedule the execution of a :ref:`coroutine <coroutine>`: wrap it in a
320320
future. A task is a subclass of :class:`Future`.
321321

322-
A task is responsible to execute a coroutine object in an event loop. If
322+
A task is responsible for executing a coroutine object in an event loop. If
323323
the wrapped coroutine yields from a future, the task suspends the execution
324324
of the wrapped coroutine and waits for the completition of the future. When
325325
the future is done, the execution of the wrapped coroutine restarts with the
326326
result or the exception of the future.
327327

328328
Event loops use cooperative scheduling: an event loop only runs one task at
329-
the same time. Other tasks may run in parallel if other event loops are
329+
a time. Other tasks may run in parallel if other event loops are
330330
running in different threads. While a task waits for the completion of a
331331
future, the event loop executes a new task.
332332

333-
The cancellation of a task is different than cancelling a future. Calling
333+
The cancellation of a task is different from the cancelation of a future. Calling
334334
:meth:`cancel` will throw a :exc:`~concurrent.futures.CancelledError` to the
335335
wrapped coroutine. :meth:`~Future.cancelled` only returns ``True`` if the
336336
wrapped coroutine did not catch the
@@ -341,7 +341,7 @@ Task
341341
<coroutine>` did not complete. It is probably a bug and a warning is
342342
logged: see :ref:`Pending task destroyed <asyncio-pending-task-destroyed>`.
343343

344-
Don't create directly :class:`Task` instances: use the :func:`async`
344+
Don't directly create :class:`Task` instances: use the :func:`async`
345345
function or the :meth:`BaseEventLoop.create_task` method.
346346

347347
.. classmethod:: all_tasks(loop=None)
@@ -360,17 +360,17 @@ Task
360360

361361
.. method:: cancel()
362362

363-
Request this task to cancel itself.
363+
Request that this task cancel itself.
364364

365365
This arranges for a :exc:`~concurrent.futures.CancelledError` to be
366366
thrown into the wrapped coroutine on the next cycle through the event
367367
loop. The coroutine then has a chance to clean up or even deny the
368368
request using try/except/finally.
369369

370-
Contrary to :meth:`Future.cancel`, this does not guarantee that the task
370+
Unlike :meth:`Future.cancel`, this does not guarantee that the task
371371
will be cancelled: the exception might be caught and acted upon, delaying
372-
cancellation of the task or preventing it completely. The task may also
373-
return a value or raise a different exception.
372+
cancellation of the task or preventing cancellation completely. The task
373+
may also return a value or raise a different exception.
374374

375375
Immediately after this method is called, :meth:`~Future.cancelled` will
376376
not return ``True`` (unless the task was already cancelled). A task will
@@ -405,7 +405,7 @@ Task
405405
This produces output similar to that of the traceback module, for the
406406
frames retrieved by get_stack(). The limit argument is passed to
407407
get_stack(). The file argument is an I/O stream to which the output
408-
goes; by default it goes to sys.stderr.
408+
is written; by default output is written to sys.stderr.
409409

410410

411411
Example: Parallel execution of tasks

0 commit comments

Comments
 (0)