New init for fraction
This commit is contained in:
parent
e34215a9a9
commit
f5c64ce9e4
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user