From cd873fc1428b52620e26e44e19ce00a7ed79555c Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Mon, 11 Feb 2008 03:11:55 +0000 Subject: [PATCH] Put an extra space into the repr of a Fraction: Fraction(1, 2) instead of Fraction(1,2). --- Doc/whatsnew/2.6.rst | 4 ++-- Lib/fractions.py | 2 +- Lib/test/test_fractions.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index 83cca99dcd65..d37c5ac3042a 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -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 diff --git a/Lib/fractions.py b/Lib/fractions.py index 3f070de0f1a2..123ecb6edc09 100755 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -187,7 +187,7 @@ def denominator(a): 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)""" diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py index cd35644022b2..a79fedd1f9f9 100644 --- a/Lib/test/test_fractions.py +++ b/Lib/test/test_fractions.py @@ -363,7 +363,7 @@ def testMixedEqual(self): 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)))