diff --git a/python/main.py b/python/main.py index d5619fa..49aea5e 100644 --- a/python/main.py +++ b/python/main.py @@ -4,15 +4,9 @@ async def perform_task(): await asyncio.sleep(10) - -async def main(num_tasks): - tasks = [] - - for task_id in range(num_tasks): - task = asyncio.create_task(perform_task()) - tasks.append(task) - - await asyncio.gather(*tasks) +async def main(num_tasks: int): + gen = (asyncio.create_task(perform_task()) for i in range(num_tasks)) + await asyncio.gather(*gen) if __name__ == "__main__": if len(sys.argv) > 1: