[Patches] [ python-Patches-969805 ] str(a_tuple) == '(%s)'%',
'.join(map(str, a_tuple))
SourceForge.net
noreply at sourceforge.net
Wed Jun 9 14:48:55 EDT 2004
Patches item #969805, was opened at 2004-06-09 14:18
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=969805&group_id=5470
Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Grégoire Dooms (dooms)
Assigned to: Raymond Hettinger (rhettinger)
Summary: str(a_tuple) == '(%s)'%', '.join(map(str,a_tuple))
Initial Comment:
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.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2004-06-09 14:48
Message:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=969805&group_id=5470
More information about the Patches
mailing list