diff --git a/README.rst b/README.rst index fb77565ed3..255a1ff26a 100644 --- a/README.rst +++ b/README.rst @@ -88,14 +88,8 @@ Usage # get request is received. Note that, the set request above was # blocking since it calls ".result()" on the returned Future, whereas # the get request below is non-blocking. - - - def callback(future): - # Outputs "value" - print(future.result()) - - - distributed_map.get("key").add_done_callback(callback) + get_future = distributed_map.get("key") + get_future.add_done_callback(lambda future: print(future.result())) # Do other operations. The operations below won't wait for # the get request above to complete. diff --git a/docs/index.rst b/docs/index.rst index 4560c32a52..45c7acf7bd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -47,14 +47,8 @@ Overview # get request is received. Note that, the set request above was # blocking since it calls ".result()" on the returned Future, whereas # the get request below is non-blocking. - - - def callback(future): - # Outputs "value" - print(future.result()) - - - distributed_map.get("key").add_done_callback(callback) + get_future = distributed_map.get("key") + get_future.add_done_callback(lambda future: print(future.result())) # Do other operations. The operations below won't wait for # the get request above to complete. @@ -65,7 +59,6 @@ Overview client.shutdown() - .. toctree:: :hidden: