dimod.variables.Variables._append#
- Variables._append(v=None, permissive=False)[source]#
Append a new variable.
- Parameters:
v (
Variable
, optional) – Add a new variable. IfNone
, 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 aValueError
. IfTrue
, appending a variable that already exists will not change the container.
- Returns:
The label of the appended variable.
- Return type:
- Raises:
ValueError – If the variable is present and
permissive
isFalse
.
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.