Last active
December 14, 2016 19:04
-
-
Save fabiocerqueira/8a89da798b3d4d3319533f826772095f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from types import coroutine | |
@coroutine | |
def spam(): | |
result = yield 'somevalue' | |
print("Got it:", result) | |
async def foo(): | |
print('Start foo') | |
await spam() | |
print('End foo') | |
if __name__ == '__main__': | |
ret = None | |
f = spam() | |
while 1: | |
try: | |
ret = f.send(ret) | |
except StopIteration: | |
break | |
print('#' * 20) | |
print('Testing foo...') | |
print('#' * 20) | |
ret = None | |
f = foo() | |
while 1: | |
try: | |
ret = f.send(ret) | |
except StopIteration: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment