Last active
February 19, 2017 04:28
-
-
Save markrwilliams/b7a3c5b914d1f207e2250c421760d51c 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
import asyncio | |
def adapt(the_future): | |
try: | |
print("*** result before") | |
the_future.result() | |
except: | |
print("*** exception before") | |
the_future.exception() | |
f = asyncio.ensure_future(asyncio.sleep(10)) | |
f.add_done_callback(adapt) | |
f.cancel() | |
asyncio.get_event_loop().run_until_complete(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment