dimod.variables.Variables._append#

Variables._append(v=None, permissive=False)[source]#

Append a new variable.

Parameters:
  • v (Variable, 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:

Variable

Raises:

ValueError – If the variable is present and permissive is False.

Caution

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