[Python-checkins] r60723 - in python/trunk: Doc/whatsnew/2.6.rst Lib/fractions.py Lib/test/test_fractions.py

mark.dickinson python-checkins at python.org
Mon Feb 11 04:11:55 CET 2008


Author: mark.dickinson
Date: Mon Feb 11 04:11:55 2008
New Revision: 60723

Modified:
   python/trunk/Doc/whatsnew/2.6.rst
   python/trunk/Lib/fractions.py
   python/trunk/Lib/test/test_fractions.py
Log:
Put an extra space into the repr of a Fraction:
Fraction(1, 2) instead of Fraction(1,2).


Modified: python/trunk/Doc/whatsnew/2.6.rst
==============================================================================
--- python/trunk/Doc/whatsnew/2.6.rst	(original)
+++ python/trunk/Doc/whatsnew/2.6.rst	Mon Feb 11 04:11:55 2008
@@ -616,9 +616,9 @@
     >>> 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

Modified: python/trunk/Lib/fractions.py
==============================================================================
--- python/trunk/Lib/fractions.py	(original)
+++ python/trunk/Lib/fractions.py	Mon Feb 11 04:11:55 2008
@@ -187,7 +187,7 @@
 
     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)"""

Modified: python/trunk/Lib/test/test_fractions.py
==============================================================================
--- python/trunk/Lib/test/test_fractions.py	(original)
+++ python/trunk/Lib/test/test_fractions.py	Mon Feb 11 04:11:55 2008
@@ -363,7 +363,7 @@
         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)))
 


More information about the Python-checkins mailing list