From: Bar Harel Date: Sat, 23 May 2020 23:14:31 +0000 (+0300) Subject: bpo-40405: Fix asyncio.as_completed docs (GH-19753) X-Git-Tag: v3.10.0a1~847 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13206b52d16c2489f4c7dd2dce2a7f48a554b5ed;p=thirdparty%2FPython%2Fcpython.git bpo-40405: Fix asyncio.as_completed docs (GH-19753) * Fix as_completed docs to correctly state the function return value. * Also, improves the general wording of the as_completed documentation. Co-Authored-By: Rémi Lapeyre Co-Authored-By: Kyle Stanley Co-Authored-By: Yury Selivanov --- diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index dd94c1485483..847363b134a7 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -585,9 +585,9 @@ Waiting Primitives .. function:: as_completed(aws, \*, loop=None, timeout=None) Run :ref:`awaitable objects ` in the *aws* - set concurrently. Return an iterator of :class:`Future` objects. - Each Future object returned represents the earliest result - from the set of the remaining awaitables. + set concurrently. Return an iterator of coroutines. + Each coroutine returned can be awaited to get the earliest next + result from the set of the remaining awaitables. Raises :exc:`asyncio.TimeoutError` if the timeout occurs before all Futures are done. @@ -597,8 +597,8 @@ Waiting Primitives Example:: - for f in as_completed(aws): - earliest_result = await f + for coro in as_completed(aws): + earliest_result = await coro # ...