parse_statement function¶
(Shortest import: from brian2.parsing.statements import parse_statement)
-
brian2.parsing.statements.
parse_statement
(code)[source]¶ Parses a single line of code into “var op expr”.
Parameters: code : str
A string containing a single statement of the form
var op expr # comment
, where the# comment
part is optional.Returns: var, op, expr, comment : str, str, str, str
The four parts of the statement.
Examples
>>> parse_statement('v = -65*mV # reset the membrane potential') ('v', '=', '-65*mV', 'reset the membrane potential') >>> parse_statement('v += dt*(-v/tau)') ('v', '+=', 'dt*(-v/tau)', '')