Python3 Asyncio implements an event loop, but in quite low level, it's missing some basic helpers that can make your life a lot easier.
The Pool and Group are typical missing ones. Compare these codes below
- without group
@asyncio.coroutine
def f1():
yield from asyncio.sleep(1.0)
tasks = [asyncio.async(f1()) for _ in range(10)]
asyncio.get_event_loop().run_until_complete(asyncio.wait(tasks))
- with group
@asyncio.coroutine
def f1():
yield from asyncio.sleep(1.0)
g = Group()
for _ in range(10):
g.spawn(f1())
g.join()