Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 9
    @Kingname ..wat Commented Jul 23, 2020 at 1:02
  • 3
    do you mean that asyncio.gather will have to wait for all of them to complete, while asyncio.wait will return to you the current status of each one (pending or not)? Reading your answer is not clear to me Commented May 12, 2021 at 7:30
  • 3
    @EigenFool As of Python 3.9, asyncio.wait has a parameter called return_when, which you can use to control when the event loop should yield back to you. asyncio.gather does not have such parameter, the event loop only get back to you when all tasks have finished/failed. Read the official docs here: docs.python.org/3/library/asyncio-task.html#asyncio.wait Commented May 12, 2021 at 8:18
  • 4
    @ospider The parameter called return_when for asyncio.wait is already available in Python 3.5.9! See here: docs.python.org/3.5/library/asyncio-task.html#asyncio.wait Commented May 27, 2021 at 18:28
  • 2
    @Kingname python -m timeit "print('hello')" gives 36.6 usec per loop, so 10000000000000 print('hello') will take 11.6 years to complete for just print() function Commented Jun 22, 2021 at 2:46