summaryrefslogtreecommitdiff
path: root/examples/hello_coroutine.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hello_coroutine.py')
-rw-r--r--examples/hello_coroutine.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/hello_coroutine.py b/examples/hello_coroutine.py
index b9347aa..e6a4e6c 100644
--- a/examples/hello_coroutine.py
+++ b/examples/hello_coroutine.py
@@ -1,17 +1,18 @@
"""Print 'Hello World' every two seconds, using a coroutine."""
-import asyncio
+import trollius
+from trollius import From
-@asyncio.coroutine
+@trollius.coroutine
def greet_every_two_seconds():
while True:
print('Hello World')
- yield from asyncio.sleep(2)
+ yield From(trollius.sleep(2))
if __name__ == '__main__':
- loop = asyncio.get_event_loop()
+ loop = trollius.get_event_loop()
try:
loop.run_until_complete(greet_every_two_seconds())
finally: