Code Room
Code reviewHard
Question
Review this Python asyncio helper that races two coroutines and returns the first result.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
import asyncio async def first_of(coro_a, coro_b): task_a = asyncio.create_task(coro_a) task_b = asyncio.create_task(coro_b) done, pending = await asyncio.wait( [task_a, task_b], return_when=asyncio.FIRST_COMPLETED ) return done.pop().result()Run or narrate your approach, then ask the coach.