expression_complexity function

(Shortest import: from brian2.parsing.sympytools import expression_complexity)

brian2.parsing.sympytools.expression_complexity(expr, complexity=None)[source]

Returns the complexity of an expression (either string or sympy)

The complexity is defined as 1 for each arithmetic operation except divide which is 2, and all other operations are 20. This can be overridden using the complexity argument.

Note: calling this on a statement rather than an expression is likely to lead to errors.