asyncio_slow: Add callback example from docs.

asyncio
Paul Sokolovsky 2014-05-01 23:45:04 +03:00
rodzic 1d7b189e75
commit b0c4fc7536
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -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()