def __mul__(self, value):
     """
     Given a constant (we assume this for now),
     add an object to the arithmetic stack so it can be applied
     later when values are checked.
     """
     if self._state._arithmetic_build:
         self._state._arithmetic_stack.append(
             formula_tree.ArithmeticMultiply(value))
     return self
Exemple #2
0
 def __mul__(self, value):
     """
     Given a constant (we assume this for now),
     add an object to the arithmetic stack so it can be applied
     later when values are checked.
     """
     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.ArithmeticMultiply(value))
         return self
     else:
         raise Exception(
             "Value used to multiply quantity %s must be of type int or float."
             % self)