def __add__(self, other):
if isinstance(other, numbers.Number):<EOL><INDENT>if math.isinf(self._offset) or math.isinf(other):<EOL><INDENT>return self.__class__(offset=self._offset + other)<EOL><DEDENT>return self.__class__(self._variables, self._offset + other)<EOL><DEDENT>elif isinstance(other, self.__class__):<EOL><INDENT>if math.isinf(self._offset) or math.isinf(other._offset):<EOL><INDENT>return self.__class__(offset=self._offset + other._offset)<EOL><DEDENT>variables = Counter(self._variables)<EOL>variables.update(other._variables)<EOL>return self.__class__(variables, self._offset + other._offset)<EOL><DEDENT>return NotImplemented<EOL>
Add expression with a number or another expression