On Tue, May 27, 2008 at 1:36 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> On Tue, May 27, 2008 at 06:13:39PM +1000, Nick Coghlan wrote:
>> str([1, 2, 3]), str(list("123")) and str(["1, 2, 3"]) should all produce
>> distinctive output: calling repr() on container contents achieves this,
>> calling str() does not.
>
>   String representation is a special case and *the only* special case, and
> must be handled as a special case. I don't like this special case to be used
> as a model for all other types. No other type allows usage like list("123").
>
>> While it could be argued that if you want unambiguous output you should
>> be invoking repr() on the container instead of str(), I'm still seeing
>> many more downsides than upsides to the idea of making str() on the
>> builtin containers display their contents with str() instead of repr().
>
>   The decision should be upon the user. In an ideal world str(container)
> calls str() on items, and repr(container) calls repr() on items, so the
> user can choose what [s]he wants. Currently user is just stuck with repr().

I disagree. Calling str() on items is counterproductive.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to