def _do_op(cls, self, other, op): first, second = cls(self), cls(other) units = second.units or first.units value = op(float(first), float(second)) value /= CONV_FACTOR.get(units, 1.0) return cls((value, units))
def __float__(self): return self.value * CONV_FACTOR.get(self.units, 1.0)
def _do_op(cls, self, other, op): value = op(float(self), float(other)) value /= CONV_FACTOR.get(self.units or other.units, 1.0) return cls((value, self.units or other.units))