Statements class

(Shortest import: from brian2 import Statements)

class brian2.equations.codestrings.Statements(code, **substitutions)[source]

Bases: CodeString

Class for representing statements with support for substitution.

Parameters:

code : str

The statement or statements. Several statements can be given as a multi-line string or separated by semicolons.

**substitutions :

Substitutions to apply to the code. Can be either strings (to replace a name with another name) or values (to replace a name with a value).

Examples

>>> Statements('g += w')
Statements('g += w')
>>> Statements('g += k*w', k=0.3)
Statements('g += (0.3)*w')
>>> Statements('g += k*w', g='g_ampa')
Statements('g_ampa += k*w')
>>> Statements('g += k*w', g='g_ampa', k=0.3)
Statements('g_ampa += (0.3)*w')