Skip to content

Instantly share code, notes, and snippets.

@avenet
Created September 15, 2015 21:15
Show Gist options
  • Save avenet/193a6b409a69e0c8b6d9 to your computer and use it in GitHub Desktop.
Save avenet/193a6b409a69e0c8b6d9 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