New init for fraction

This commit is contained in:
Benjamin Bertrand 2016-03-09 10:49:29 +03:00
parent e34215a9a9
commit f5c64ce9e4
1 changed files with 3 additions and 3 deletions

View File

@ -22,13 +22,14 @@ class Fraction(Explicable):
:param denom: the denominator
"""
super(Fraction, self).__init__()
self._num = num
if denom == 0:
raise ZeroDivisionError("Can't create Fraction: division by zero")
self._denom = denom
self.isNumber = 1
pstf_tokens = self.compute_postfix_tokens()
super(Fraction, self).__init__(pstf_tokens)
def simplify(self):
"""Simplify the fraction
@ -87,8 +88,7 @@ class Fraction(Explicable):
else:
return copy(self)
@property
def postfix_tokens(self):
def compute_postfix_tokens(self):
"""Postfix form of the fraction
>>> f = Fraction(3, 5)