Reupload (purge)

This commit is contained in:
gauvainboiche
2026-08-04 16:42:35 +02:00
commit bb74ba5173
1023 changed files with 79600 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import asyncio
async def coro(numbers):
await asyncio.sleep(min(numbers))
return list(reversed(numbers))
async def main():
task1 = asyncio.create_task(coro= coro([10, 5, 2]))
task2 = asyncio.create_task(coro= coro([3, 2, 1]))
for task in asyncio.as_completed([task1, task2]):
result = await task
print(f"{type(task)=}")
print(result)
if __name__ == "__main__":
asyncio.run(main())
"""
await coro(utine) : exécute immédiatement et attend qu'elle finisse
create_task() : planifie une coroutine en arrière-plan
"""