constant_or_scalar function

(Shortest import: from brian2.codegen.codeobject import constant_or_scalar)

brian2.codegen.codeobject.constant_or_scalar(varname, variable)[source]

Convenience function to generate code to access the value of a variable. Will return 'varname' if the variable is a constant, and array_name[0] if it is a scalar array.