str() of a tuple

Martin v. Loewis martin at
Wed Sep 4 23:42:55 CEST 2002

Douglas Zongker <dougz at> writes:

> Why, oh why does the str() of a container use the repr()s of the
> objects inside?  This seems to violate what the docs claim str() does
> -- "return a nicely printable representation of an object."  Would a
> sane implementation break something?

Yes. If you have [''], then recursively printing this using str would
produce '[]', which would be confusing.


More information about the Python-list mailing list