BrianPreference class

(Shortest import: from brian2 import BrianPreference)

class brian2.core.preferences.BrianPreference(default, docs, validator=None, representor=<built-in function repr>)[source]

Bases: object

Used for defining a Brian preference.

Parameters:

default : object

The default value.

docs : str

Documentation for the preference value.

validator : func

A function that True or False depending on whether the preference value is valid or not. If not specified, uses the DefaultValidator for the default value provided (check if the class is the same, and for Quantity objects, whether the units are consistent).

representor : func

A function that returns a string representation of a valid preference value that can be passed to eval. By default, uses repr which works in almost all cases.