[Python-ideas] Reviving PEP 3140 - "str(container) should call str(item), not repr(item)"

Piotr Dobrogost p at google-groups-2013.dobrogost.net
Mon Apr 8 11:56:08 CEST 2013


On Fri, Apr 5, 2013 at 12:36 AM, Guido van Rossum <guido at python.org> wrote:

> Lots of reasons. E.g. would you really like this outcome?
>
> >>> a = 'foo, bar'
> >>> b = [a]
> >>> print(b)
> [foo, bar]
> >>>
>

This is indeed unfortunate but could be mitigated in some extent by
enclosing container's elements with let's say pair of <>. Yes, I know it
doesn't solve the problem but anything is better than having str()
duplicate what repr() does. If I want to get repr I'll call repr() but when
I call str() I expect to get some sensible, middle-ground representation
not the same thing repr() already provides.


On Fri, Apr 5, 2013 at 12:36 AM, Guido van Rossum <guido at python.org> wrote:

> Lots of reasons. E.g. would you really like this outcome?
>
> >>> a = 'foo, bar'
> >>> b = [a]
> >>> print(b)
> [foo, bar]
> >>>
>
> Plus of course there really would be tons of backwards compatibility
> issues.
>
> On Thu, Apr 4, 2013 at 2:57 PM, Piotr Dobrogost
> <p at google-groups-2013.dobrogost.net> wrote:
> > Hi!
> >
> > Having str(container) calling str(item) and not repr(item) sounds like
> the
> > right thing to do. However, PEP 3140 was rejected on the basis of the
> > following statement of Guido:
> >
> > "Let me just save everyone a lot of time and say that I'm opposed to
> > this change, and that I believe that it would cause way too much
> > disturbance to be accepted this close to beta."
> >
> >
> > Thu, 29 May 2008 12:32:04 -0700
> > (http://www.mail-archive.com/python-3000@python.org/msg13686.html)
> >
> > Does anyone know what's the reason Guido was opposed to this change?
> > Is there any chance to revive this PEP?
> >
> >
> > Regards,
> > Piotr Dobrogost
> >
> > _______________________________________________
> > Python-ideas mailing list
> > Python-ideas at python.org
> > http://mail.python.org/mailman/listinfo/python-ideas
> >
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130408/57c547ff/attachment.html>


More information about the Python-ideas mailing list