]> granicus.if.org Git - python/commitdiff
Put an extra space into the repr of a Fraction:
authorMark Dickinson <dickinsm@gmail.com>
Mon, 11 Feb 2008 03:11:55 +0000 (03:11 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Mon, 11 Feb 2008 03:11:55 +0000 (03:11 +0000)
Fraction(1, 2) instead of Fraction(1,2).

Doc/whatsnew/2.6.rst
Lib/fractions.py
Lib/test/test_fractions.py

index 83cca99dcd654f06f92e284cdc6394bee48efb01..d37c5ac3042a2784417050216914fb9bd206e482 100644 (file)
@@ -616,9 +616,9 @@ that will be the numerator and denominator of the resulting fraction. ::
     >>> float(a), float(b)
     (0.66666666666666663, 0.40000000000000002)
     >>> a+b
-    Fraction(16,15)
+    Fraction(16, 15)
     >>> a/b
-    Fraction(5,3)
+    Fraction(5, 3)
 
 The :mod:`fractions` module is based upon an implementation by Sjoerd
 Mullender that was in Python's :file:`Demo/classes/` directory for a
index 3f070de0f1a27a030cb8af961a8c532d5ba382da..123ecb6edc093c70d28653219d1ed3f974f70125 100755 (executable)
@@ -187,7 +187,7 @@ class Fraction(Rational):
 
     def __repr__(self):
         """repr(self)"""
-        return ('Fraction(%r,%r)' % (self.numerator, self.denominator))
+        return ('Fraction(%r, %r)' % (self.numerator, self.denominator))
 
     def __str__(self):
         """str(self)"""
index cd35644022b244f9e07d565154ac422ab7488b11..a79fedd1f9f968bdcc0b6814dad533686bb3d4e5 100644 (file)
@@ -363,7 +363,7 @@ class FractionTest(unittest.TestCase):
         self.assertFalse(R(5, 2) == 2)
 
     def testStringification(self):
-        self.assertEquals("Fraction(7,3)", repr(R(7, 3)))
+        self.assertEquals("Fraction(7, 3)", repr(R(7, 3)))
         self.assertEquals("7/3", str(R(7, 3)))
         self.assertEquals("7", str(R(7, 1)))