This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: str(a_tuple) == '(%s)'%', '.join(map(str,a_tuple))
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: dooms, rhettinger, tim.peters
Priority: normal Keywords: patch

Created on 2004-06-09 18:18 by dooms, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tupleobject.diff dooms, 2004-06-09 18:18 context diff of python2.3-2.3.3/Objects/tupleobject.c
Messages (3)
msg46153 - (view) Author: Grégoire Dooms (dooms) Date: 2004-06-09 18:18
This patch against Python 2.3.3 ensures that str is 
recursively applied to  
members of a tuple when called on a tuple.  
 
Currently (python 2.3 and 20040609 cvs HEAD branch  
too) repr is applied to the members of the tuple such  that  
>>> str((1,0.1))  
'(1, 0.10000000000000001)'  
  
With this patch:  
>>> str((1,0.1))   
'(1, 0.1)'  
 
This patch is easily transposable to cvs HEAD an to lists. 
 
msg46154 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-06-09 18:48
Logged In: YES 
user_id=31435

What if the tuple is ("1, 2", "3")?

The primary reason str(container) applies repr to the 
containees is so that contained strings are rendered 
unambiguously.  Debated ad nauseum many times on python-
dev over the years, with no good resolution.
msg46155 - (view) Author: Grégoire Dooms (dooms) Date: 2004-06-09 19:02
Logged In: YES 
user_id=846867

 
History
Date User Action Args
2022-04-11 14:56:04adminsetgithub: 40370
2004-06-09 18:18:19doomscreate