We used to use cexprtk which treats ^ as power operation. As we converted to simpleeval which treats this as bitwise XOR, we had to put the change advised in the README.
>>> import ast
>>> from simpleeval import safe_power
>>> s = SimpleEval()
>>> s.operators[ast.BitXor] = safe_power
>>> s.eval("3 ^ 2")
9
Unfortunately this does not change the order of operation. Below is an example (both should result into 6):
>>> s.eval("5**1+1")
6
>>> s.eval("5^1+1")
25
We used to use
cexprtkwhich treats^as power operation. As we converted tosimpleevalwhich treats this as bitwise XOR, we had to put the change advised in the README.Unfortunately this does not change the order of operation. Below is an example (both should result into 6):