示例#1
0
 def __add__(self, value):
     if type(value) in [int, float]:
         base_variable = composition_sequence_from_value([self._state],
                                                         self._state)[-1]
         if base_variable._arithmetic_build:
             self._state._arithmetic_stack.append(
                 formula_tree.ArithmeticAdd(value))
         return self
     else:
         raise Exception(
             "Value added to quantity %s must be of type int or float." %
             self)
示例#2
0
 def __add__(self, value):
     if self._state._arithmetic_build:
         self._state._arithmetic_stack.append(
             formula_tree.ArithmeticAdd(value))
     return self