ENع
الدرس 25 · Idiomatic Python

asyncio

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

asyncio lets one Python thread juggle many slow waits. Follow brew.py, a ten-line program, through the event loop: a coroutine object that does nothing until something drives it, asyncio.run(), Tasks made with asyncio.TaskGroup, tasks parking at await while their timers run, and results kept on each Task. Two waits of 2 and 1 seconds finish together in about 2 seconds. Then meet the classic trap: awaiting coroutines one after another takes the full 3.

14 دقيقة10 خطوات5 أسئلةAdvanced
شكل 25 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.