Skip to content

Commit b0c4fc7

Browse files
committed
asyncio_slow: Add callback example from docs.
1 parent 1d7b189 commit b0c4fc7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# https://docs.python.org/3.4/library/asyncio-eventloop.html#example-hello-world-callback
2+
#import asyncio
3+
import asyncio_slow as asyncio
4+
5+
def print_and_repeat(loop):
6+
print('Hello World')
7+
loop.call_later(2, print_and_repeat, loop)
8+
9+
loop = asyncio.get_event_loop()
10+
loop.call_soon(print_and_repeat, loop)
11+
loop.run_forever()

0 commit comments

Comments
 (0)