Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardPythonasyncio event loop internalsSingle-choice MCQ

Inside a running loop you schedule two callbacks with loop.call_soon and then await asyncio.sleep(0). In what order do they run, and why?

loop.call_soon(lambda: order.append('a')) loop.call_soon(lambda: order.append('b')) await asyncio.sleep(0) # order is ['a', 'b']