From d50091b802c7e0f57926c968d06db6c96cd84c1a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 1 May 2014 23:45:04 +0300 Subject: [PATCH] asyncio_slow: Add callback example from docs. --- asyncio_slow/test_hello_world_callback.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 asyncio_slow/test_hello_world_callback.py diff --git a/asyncio_slow/test_hello_world_callback.py b/asyncio_slow/test_hello_world_callback.py new file mode 100644 index 00000000..9836ffd7 --- /dev/null +++ b/asyncio_slow/test_hello_world_callback.py @@ -0,0 +1,11 @@ +# https://docs.python.org/3.4/library/asyncio-eventloop.html#example-hello-world-callback +#import asyncio +import asyncio_slow as asyncio + +def print_and_repeat(loop): + print('Hello World') + loop.call_later(2, print_and_repeat, loop) + +loop = asyncio.get_event_loop() +loop.call_soon(print_and_repeat, loop) +loop.run_forever()