mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Put an extra space into the repr of a Fraction:
Fraction(1, 2) instead of Fraction(1,2).
This commit is contained in:
		
							parent
							
								
									03d3abf375
								
							
						
					
					
						commit
						cd873fc142
					
				
					 3 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -616,9 +616,9 @@ that will be the numerator and denominator of the resulting fraction. ::
 | 
				
			||||||
    >>> float(a), float(b)
 | 
					    >>> float(a), float(b)
 | 
				
			||||||
    (0.66666666666666663, 0.40000000000000002)
 | 
					    (0.66666666666666663, 0.40000000000000002)
 | 
				
			||||||
    >>> a+b
 | 
					    >>> a+b
 | 
				
			||||||
    Fraction(16,15)
 | 
					    Fraction(16, 15)
 | 
				
			||||||
    >>> a/b
 | 
					    >>> a/b
 | 
				
			||||||
    Fraction(5,3)
 | 
					    Fraction(5, 3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The :mod:`fractions` module is based upon an implementation by Sjoerd
 | 
					The :mod:`fractions` module is based upon an implementation by Sjoerd
 | 
				
			||||||
Mullender that was in Python's :file:`Demo/classes/` directory for a
 | 
					Mullender that was in Python's :file:`Demo/classes/` directory for a
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -187,7 +187,7 @@ def denominator(a):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					    def __repr__(self):
 | 
				
			||||||
        """repr(self)"""
 | 
					        """repr(self)"""
 | 
				
			||||||
        return ('Fraction(%r,%r)' % (self.numerator, self.denominator))
 | 
					        return ('Fraction(%r, %r)' % (self.numerator, self.denominator))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __str__(self):
 | 
					    def __str__(self):
 | 
				
			||||||
        """str(self)"""
 | 
					        """str(self)"""
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -363,7 +363,7 @@ def testMixedEqual(self):
 | 
				
			||||||
        self.assertFalse(R(5, 2) == 2)
 | 
					        self.assertFalse(R(5, 2) == 2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def testStringification(self):
 | 
					    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/3", str(R(7, 3)))
 | 
				
			||||||
        self.assertEquals("7", str(R(7, 1)))
 | 
					        self.assertEquals("7", str(R(7, 1)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue