From: Andrew Svetlov Date: Mon, 8 Aug 2016 00:10:39 +0000 (+0300) Subject: Use asyncio.gather instead of asyncio.wait in example. X-Git-Tag: v3.6.0a4~56^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4365b8302db6e100e3ad4bddf891c8a4e747c5c1;p=thirdparty%2FPython%2Fcpython.git Use asyncio.gather instead of asyncio.wait in example. gather will raise exception in case of problem but wait just returns done and pending lists of futures. For getting error every future result should be retrieved, which is boring and error prone. --- diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index de6ee58e9207..c6c77be50718 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -486,7 +486,7 @@ Example executing 3 tasks (A, B, C) in parallel:: asyncio.ensure_future(factorial("A", 2)), asyncio.ensure_future(factorial("B", 3)), asyncio.ensure_future(factorial("C", 4))] - loop.run_until_complete(asyncio.wait(tasks)) + loop.run_until_complete(asyncio.gather(*tasks)) loop.close() Output::