Last active
April 15, 2016 01:43
-
-
Save nakamuray/c0a304cdd102703522d8e145273490c7 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 concurrent.futures import Future | |
fut = Future() | |
fut.add_done_callback(lambda f: f.result() * 2) | |
fut.set_result(21) | |
print(fut.result()) | |
#assert fut.result() == 42 | |
fut = Future() | |
fut.add_done_callback(lambda f: f.set_result(f.result() * 2)) | |
fut.set_result(21) | |
print(fut.result()) | |
assert fut.result() == 42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
result: