python:asyncio
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| python:asyncio [2025/12/12 12:24] – v1ctor | python:asyncio [2025/12/15 13:02] (current) – v1ctor | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| '' | '' | ||
| - | '' | + | '' |
| + | |||
| + | ==== TASKS ==== | ||
| + | |||
| + | '' | ||
| + | |||
| + | Task can be cancelled: | ||
| + | <code python> | ||
| + | long_task = asyncio.create_task(delay(10)) | ||
| + | while not long_task.done(): | ||
| + | long_task.cancel() | ||
| + | |||
| + | try: | ||
| + | await long_task | ||
| + | except CancelledError: | ||
| + | print(" | ||
| + | </ | ||
python/asyncio.1765542273.txt.gz · Last modified: by v1ctor
