[Python-3000] UPDATED: PEP 3138- String representation in Python 3000

Jim Jewett jimjjewett at gmail.com
Wed May 28 02:52:06 CEST 2008


On 5/27/08, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Blake Winton wrote:

> > But which downsides do you see that aren't solved by the use of repr to
> get unambiguous output?

>  The fact that calling str() on containers has been unambiguous for years.
> All I'm saying is that no compelling use cases have been presented to
> justify changing the status quo (aside from the Unicode escaping problem,
> which is better addressed by allowing repr() to return arbitrary Unicode
> glyphs as proposed by PEP 3138, since that also fixes a bunch of other cases
> where repr() is invoked on Unicode strings).

I think it is pretty clear that there are sometimes reasons to want
more than one string representation.  There are arguably far more than
two distinctions that would be useful, but two is what the language
supports.  That was the justification for str vs repr in the first
place.

What is the advantage in continuing to conflate the two for (only
portions of) containers?

The only justfication that I can see is "backwards compatibility",
which applies even more strongly to repr than it does to str.

-jJ


More information about the Python-3000 mailing list