Differences Between Resolver One's Formula Language and Python Expressions
Though Resolver One user code is pure Python, the formula language (as used in the formula bar) has been modified for compatibility with other spreadsheet applications.
List comprehensions: "in" clause trailing commas disallowed
To accommodate the IF function, the trailing commas of the Python list comprehension "in" clause are disallowed. For example, =[a for a in 1, 2,] is invalid because of the last comma.
Equality operator: '=' and '==' interchangeable
Unlike Python, '=' and '==' both work as the equality operator. For example, the following are both valid with the same meaning:
=IF(1 = 2, 3, 4) =IF(1 == 2, 3, 4)
Functions: Specify keyword values using ':=' operator
Since '=' is the equality operator, ':=' specifies values for keyword arguments. For example, the following is valid:
=function(a:=3, b:=None)
Resolver One treats attempts to pass keyword arguments using '=' as expressions, probably resulting in a NameError (unless the keyword happens to also be a variable you have defined).
The following function calls are therefore equivalent:
function(a=1) function(a==1)
'&' operator: Returns a concatenated string
The '&' operator converts its operands to strings and concatenates them, whereas in Python it is the bitwise-and operator.
'^' operator: Raises to the power of
The caret ('^') means 'to the power of'. For example, 3 ^ 3 has the same meaning as 3 ** 3 (which also works).
In Python, '^' is the bitwise-xor operator.
':' operator: Denotes cell ranges (Python colons replaced by '->')
The colon (':') denotes cell ranges, e.g. Sheet1!C3:D8.
All Python colons have been replaced by arrows ('->'). Lambdas, slices and dictionaries in the formula language are as follows:
=lambda x -> x + 1
=somelist[3->6]
={foo -> bar, baz -> qux}
'%' operator: Denotes percentage specification (replaced by '%%' for string interpolation)
The '%' operator denotes a percentage specification. String interpolation uses the operator '%%', e.g. '%s' %% variable.
New reserved word: 'self'
When used in a formula in a cell, the variable self represents the cell the expression is defined on. For column and row formulae it represents the cell that is being set. The following displays a cell's column and row:
= (self.Col, self.Row)
Comments
If you have comments, questions or suggestions about any of the Resolver One documentation, please post them to the Documentation Suggestions Forum.
