add float method in fraction

This commit is contained in:
Lafrite 2014-02-21 11:08:55 +01:00
parent 1abd903c9b
commit 8e86220b50

View File

@ -56,6 +56,9 @@ class Fraction(object):
def __repr__(self):
return "< Fraction " + self.__str__() + ">"
def __float__(self):
return self._num / self._denom
def __add__(self, other):
if type(other) == Fraction:
#cool