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

Ned Batchelder ned at nedbatchelder.com
Fri Apr 5 02:26:59 CEST 2013


On 4/4/2013 5:57 PM, Piotr Dobrogost 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/search?l=python-3000@python.org&q=date:20080529> 
> (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?
>

repr() is for geeks, str() is for civilians.  Since str(list) prints 
square brackets and commas, it's for geeks anyway, so it prints the 
repr() of its contents.  If you want a for-civilian output of a list, 
you have to construct it yourself.

--Ned.

>
> Regards,
> Piotr Dobrogost
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130404/78138837/attachment.html>


More information about the Python-ideas mailing list