Skip to main content

Practice ยท 2 of 2

Bounded Waits

Implement async def with_deadline(coro, seconds) awaiting asyncio.wait_for(coro, timeout=seconds) and returning ('ok', result) on success or ('timeout', None) on asyncio.TimeoutError. Provide sync wrapper run_deadline(coro, seconds).

Difficulty: intermediate

Back to lesson: Practice: gather and Timeout Drills