HP Caliper Advisor Rule Writer Guide

element of a list or tuple can contain a different type of data, including (nested)
sequences and mappings. There is a special syntax for 1-element tuples (which
would otherwise be misinterpreted as a parenthesized expression): a trailing
comma. For example: (value,)
Mappings: dictionaries.
Dictionaries are mutable tables of data, accessed by a key rather than position. The
key can be any type but is often a string or numeric value. Each element can contain
a different type of data, including sequences and (nested) mappings.
Other: modules, classes, functions, files, and so forth.
Python Statements
These are the statements most likely to be used in Advisor rule functions:
Expression statements
expression
function (argument_list)
object.method (argument_list)
Assignment statements
target = expression
target op = expression (where op is one of the arithmetic or bitwise
operators, that is, +=)
target1, target2, ... = expression1, expression2, ...
(target1, target2, ...) = same_length_sequence
[target1, target2, ...] = same_length_sequence
If statement
if boolean_expression:
true_statements
elif boolean_expression:
true_statements
...
else:
false_statements
where the elif and else clauses and their associated statements are optional. Note
the use of the colon (:) after each condition and note the indented statements.
While loop
while boolean_expression:
true_statements
else:
false_statements
where the else clause and its associated statements are optional and are only
executed if the loop ends without executing a break statement. Note the use of the
colon (:) after each condition and note the indented statements.
Python Statements 67