Skip to content

Instantly share code, notes, and snippets.

import asyncio
import random
import time
async def do_stuff(i):
ran = random.uniform(1, 5)
await asyncio.sleep(ran) # NOTE if we hadn't called
# asyncio.set_event_loop() earlier, we would have to pass an event
# loop to this function explicitly.