5 ms·
This looks great, but it'll be even better with utilities that let you await multiple tasks in parallel: a, b, c = atools.join([f(), g(), h()]) and select a
by Sidnicious 12y ago
This looks great, but it'll be even better with utilities that let you await multiple tasks in parallel:
a, b, c = atools.join([f(), g(), h()])
and select among multiple async tasks (e.g. to implement a timeout):
with atools.select({"res": f(), "timeout": timeout(10)}) as tasks:
res, which = await tasks
- 1st1 12y agoThere is equivalent to 'atools.join' in asyncio. And I suspect that we'll see libraries like 'atools' in the wild if the PEP is accepted. If those libraries will end up being popular, we'll add one of the to the standard library! I like the idea of 'a, b = await foo(), bar()' syntax. I'll think of how we can implement it and integrate to the PEP. Thanks!