Fix up syntax a bit

This commit is contained in:
Jason Paryani
2014-01-13 17:00:05 -08:00
parent 0930a9fd1b
commit b0af30ebe6

View File

@@ -80,7 +80,7 @@ def main(host):
print("PASS") print("PASS")
'''Make a request to evaluate 123 + 45 - 67. '''Make a request to evaluate 123 + 45 - 67.
# //
The Calculator interface requires that we first call getOperator() to The Calculator interface requires that we first call getOperator() to
get the addition and subtraction functions, then call evaluate() to use get the addition and subtraction functions, then call evaluate() to use
them. But, once again, we can get both functions, call evaluate(), and them. But, once again, we can get both functions, call evaluate(), and
@@ -119,18 +119,16 @@ def main(host):
''' '''
Note: a one liner version of building the previous request (I highly Note: a one liner version of building the previous request (I highly
recommend not doing it this way, but I just wanted to demonstrate it is recommend not doing it this way for such a complicated structure, but I
possible to set all of the fields with a dictionary): just wanted to demonstrate it is possible to set all of the fields with a
dictionary):
eval_promise = calculator.evaluate({"call": eval_promise = calculator.evaluate(
{"function": subtract, {'call': {'function': subtract,
"params": [{"call": 'params': [{'call': {'function': add,
{"function": add, 'params': [{'literal': 123},
"params": {'literal': 45}]}},
[{"literal": 123}, {'literal': 67.0}]}})
{"literal": 45}]
}},
{"literal": 67.0}]}})
''' '''
'''Make a request to evaluate 4 * 6, then use the result in two more '''Make a request to evaluate 4 * 6, then use the result in two more