Next / Previous / Contents / Shipman's homepage

9.6. FoDim.__div__(): Divide by a constant

As with .__mul__, the right-hand operand must be a decimal, not another FoDim instance.

fohelpers.py
# - - -   F o D i m . _ _ d i v _ _

    def __div__ ( self, other ):
        '''Divide self by a constant.
        '''
        return FoDim ( self.n / Decimal(other), self.units )