Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinier Heeres <rwh@rwh.(none)>2008-06-08 17:30:51 (GMT)
committer Reinier Heeres <rwh@rwh.(none)>2008-06-08 17:30:51 (GMT)
commitae4683aa24963bc7be9e3729220c42ccf76f64d8 (patch)
tree35c9a3f974d71c75f44569db7c6301210ecd1157
parent3d46581c031bc4dd7754d40a8c0f30170a276950 (diff)
Fix bug in Rational.__rsub__ and .__neg__
-rw-r--r--rational.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/rational.py b/rational.py
index 381b05a..34b298f 100644
--- a/rational.py
+++ b/rational.py
@@ -95,7 +95,7 @@ class Rational:
return ret
def __rsub__(self, lval):
- return self.__sub__(lval)
+ return -self.__sub__(lval)
def __mul__(self, rval):
if isinstance(rval, Rational):
@@ -124,7 +124,7 @@ class Rational:
return self.__div__(lval)
def __neg__(self):
- self.n = -self.n
+ return Rational(-self.n, self.d)
def __abs__(self):
self.n = abs(self.n)