by d0mine · 5y ago · 0 comments
async with asyncio.TaskGroup() as g:
g.create_task(concurrent_task1())
g.create_task(concurrent_task1())
reminds me of the structural concurrency: async with trio.open_nursery() as nursery:
nursery.start_soon(myfunc)
nursery.start_soon(anotherfunc)
> nurseries ... rather a new control flow primitive that's just as fundamental as for loops or function callshttps://vorpus.org/blog/notes-on-structured-concurrency-or-g...
> Implementing a better task spawning API in asyncio, inspired by Trio nurseries, was the main motivation for this PEP https://www.python.org/dev/peps/pep-0654/#motivation