๐ Modern Python
async / await
Concurrent code without threads.
Define a coroutine with async def. Use await to pause for another coroutine. In Pyodide the event loop is already running, so you can await at the top level instead of calling asyncio.run().
import asyncio
async def hello():
await asyncio.sleep(0)
return "done"
print(await hello())