Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Addressing comments and taking onboard suggestions from reviewer.
  • Loading branch information
why-not-try-calmer committed Apr 20, 2023
commit a882de799fa397c82320ef27c7f17d56bcd61f6f
14 changes: 9 additions & 5 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Creating Tasks
.. note::

:meth:`asyncio.TaskGroup.create_task` is a new alternative
based on `structural concurrency principles <https://en.wikipedia.org/wiki/Structured_concurrency>`_
based on `structural concurrency principles <https://en.wikipedia.org/wiki/Structured_concurrency>`_
that allows for waiting for a group of related tasks with strong safety guarantees.

.. important::
Expand Down Expand Up @@ -461,10 +461,14 @@ Running Tasks Concurrently

.. note::
A new alternative to create and run tasks concurrently and
wait for their completion is :class:`asyncio.TaskGroup`. While *TaskGroup*
provides strong safety guarantees for scheduling a nesting of subtasks, *gather* comes in handy
for tasks that do not schedule subtasks and need to have their results consumed eagerly
(i.e. when destructuring the result(s) into a tuple).
wait for their completion is :class:`asyncio.TaskGroup`. *TaskGroup*
provides stronger safety guarantees than *gather* for scheduling a nesting of subtasks.
That is, if a task (or a subtask, a task scheduled by a task)
raises an exception, *TaskGroup* will, while *gather* will not,
cancel the remaining scheduled tasks). However the terser *gather* might be
preferred for *Iterable* of tasks which individually handle their own exceptions, or more
generally, when having some tasks survive the cancellation
of others is an acceptable outcome.

.. _asyncio_example_gather:

Expand Down