dimod.variables.Variables._append

Variables._append()[source]

Append a new variable.

Parameters
  • v (hashable, optional) – Add a new variable. If None, a new label will be generated. The generated label will be the index of the new variable if that index is available, otherwise it will be the lowest available non-negative integer.

  • permissive (bool, optional, default=False) – If False, appending a variable that already exists will raise a ValueError. If True, appending a variable that already exists will not change the container.

Returns

The label of the appended variable.

Return type

hashable

Raises
  • ValueError – If the variable is present and permissive is

  • False.

This method is semi-public. it is intended to be used by classes that have Variables as an attribute, not by the the user.