str() of a tuple

Martin v. Loewis martin at v.loewis.de
Wed Sep 4 17:42:55 EDT 2002


Douglas Zongker <dougz at cs.washington.edu> 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.

Regards,
Martin



More information about the Python-list mailing list