Add abs method for Fraction

This commit is contained in:
Lafrite 2014-02-28 08:49:03 +01:00
parent 8631cfd349
commit f444a58a2b
1 changed files with 3 additions and 0 deletions

View File

@ -273,6 +273,9 @@ class Fraction(object):
return steps
def __abs__(self):
return Fraction(abs(self._num), abs(self._denom))
def __eq__(self, other):
""" == """
if type(other) == Fraction: