I\'m trying to define a simply Fraction class
Fraction
And I\'m getting this error:
python fraction.py Traceback (most recent call last): File
You're using numerator as both a method name (def numerator(...)) and member variable name (self.numerator = n). Use set_numerator and set_denominator for the method names and it will work.
numerator
def numerator(...)
self.numerator = n
set_numerator
set_denominator
By the way, Python 2.6 has a built-in fraction class.