Subclassing FixedPoint

paul at nlhas.no paul at nlhas.no
Tue Oct 15 04:32:33 EDT 2002


Can anyone explain why the following fails when using the subclass
(recursion problem), but work using the base class? 

It worked with the last "pre-Sourceforge" version of FixedPoint, so I
presume this might be a bug in the latest version -- I just can't for
the life of me see what could cause this!

pm 

==================================================
from fixedpoint import FixedPoint

class FP(FixedPoint) :
    """Subclass of FixedPoint"""
    def __init__(self, value, precision):
        FixedPoint.__init__(self, value, precision)

def _test():
    _y = 378
    _x = FP(793.1 , 6)
    #_x = FixedPoint(793.1 , 6)
    _z = _y/_x
    print type(_y) , ' : ' ,  _y 
    print type(_x) , ' : '  , _x 
    print type(_z) , ' : ' , _z 

if __name__ == '__main__':
    _test()



More information about the Python-list mailing list