python-asyncio
Installation
SKILL.md
Quick Reference
| Function | Purpose | Code |
|---|---|---|
asyncio.run() |
Entry point | asyncio.run(main()) |
asyncio.gather() |
Concurrent tasks | await asyncio.gather(*tasks) |
asyncio.create_task() |
Fire-and-await | task = asyncio.create_task(coro) |
asyncio.TaskGroup() |
Structured concurrency | async with asyncio.TaskGroup() as tg: |
asyncio.Semaphore() |
Rate limiting | async with semaphore: |
asyncio.timeout() |
Timeout (3.11+) | async with asyncio.timeout(5.0): |
| Pattern | Sequential | Concurrent |
|---|---|---|
| Execution | await a(); await b() |
await gather(a(), b()) |
| Time | Sum of durations | Max of durations |