Skip to content

Commit 03e275f

Browse files
committed
Get rid of the unnecessary newlines in the README
As pointed out in the code review for #266, there were unnecessary newlines around the top-level callback function definition, but we left it as it is since PEP8 recommends such newlines. Changed that part to use lambdas so that we can get rid of the newlines.
1 parent 9b3a221 commit 03e275f

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

README.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,8 @@ Usage
8888
# get request is received. Note that, the set request above was
8989
# blocking since it calls ".result()" on the returned Future, whereas
9090
# the get request below is non-blocking.
91-
92-
93-
def callback(future):
94-
# Outputs "value"
95-
print(future.result())
96-
97-
98-
distributed_map.get("key").add_done_callback(callback)
91+
get_future = distributed_map.get("key")
92+
get_future.add_done_callback(lambda future: print(future.result()))
9993
10094
# Do other operations. The operations below won't wait for
10195
# the get request above to complete.

docs/index.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,8 @@ Overview
4747
# get request is received. Note that, the set request above was
4848
# blocking since it calls ".result()" on the returned Future, whereas
4949
# the get request below is non-blocking.
50-
51-
52-
def callback(future):
53-
# Outputs "value"
54-
print(future.result())
55-
56-
57-
distributed_map.get("key").add_done_callback(callback)
50+
get_future = distributed_map.get("key")
51+
get_future.add_done_callback(lambda future: print(future.result()))
5852
5953
# Do other operations. The operations below won't wait for
6054
# the get request above to complete.
@@ -65,7 +59,6 @@ Overview
6559
client.shutdown()
6660
6761
68-
6962
.. toctree::
7063
:hidden:
7164

0 commit comments

Comments
 (0)