4 ms·
> to allow concurrency, you should use asyncio.create_task on coro (formerly ensure_future). This is misleading... you can use asyncio.gather which does this i
by throwway2332 4y ago
> to allow concurrency, you should use asyncio.create_task on coro (formerly ensure_future).
This is misleading... you can use asyncio.gather which does this internally [0].
[0]: https://github.com/python/cpython/blob/main/Lib/asyncio/tasks.py#L820 https://github.com/python/cpython/blob/main/Lib/asyncio/task...
- BiteCode_dev 4y agoOnly if you wish to collect tasks where you schedule them, accumulate the results and don't need to limit concurrency.
- Spivak 4y agoSerious question, why would you limit concurrency in async world? You’re still on a single thread, why would you want to only schedule n things at a time?