check_identifier_basic function

(Shortest import: from brian2.equations.equations import check_identifier_basic)

brian2.equations.equations.check_identifier_basic(identifier)[source]

Check an identifier (usually resulting from an equation string provided by the user) for conformity with the rules. The rules are:

  1. Only ASCII characters
  2. Starts with a character, then mix of alphanumerical characters and underscore
  3. Is not a reserved keyword of Python
Parameters:

identifier : str

The identifier that should be checked

Raises

ValueError
If the identifier does not conform to the above rules.