Skip to content

Instantly share code, notes, and snippets.

@TigerND
Created May 1, 2016 20:05
Show Gist options
  • Save TigerND/9336f8cea8af8b6c7872966ff3788d64 to your computer and use it in GitHub Desktop.
Save TigerND/9336f8cea8af8b6c7872966ff3788d64 to your computer and use it in GitHub Desktop.
import asyncio
@asyncio.coroutine
def slow_operation(n):
yield from asyncio.sleep(1)
print("Slow operation {} complete".format(n))
@asyncio.coroutine
def main():
yield from asyncio.wait([
slow_operation(1),
slow_operation(2),
slow_operation(3),
])
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment