diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2016-08-08 00:10:39 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2016-08-08 00:10:39 (GMT) |
commit | 4365b8302db6e100e3ad4bddf891c8a4e747c5c1 (patch) | |
tree | a1b0409937a0b74f1b28deb37c9f3c5fd6e73c8c /Doc | |
parent | 9854789efec0c707fff871b32b2833f32b078fb3 (diff) | |
download | cpython-4365b8302db6e100e3ad4bddf891c8a4e747c5c1.zip cpython-4365b8302db6e100e3ad4bddf891c8a4e747c5c1.tar.gz cpython-4365b8302db6e100e3ad4bddf891c8a4e747c5c1.tar.bz2 |
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.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-task.rst | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index de6ee58..c6c77be 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:: |