Comment 3 for bug 686807

Revision history for this message
Jonathan Lange (jml) wrote :

The Python docs say that both provide a printable representation of an object. The differences are that str is supposed to be "nicely" printable, and that repr should try to return a string that could be evalled to create an equivalent object.

In practice, I find that a good repr is one that helps with debugging, which sometimes involves including the object id.

Having either of them as part of a public API feels wrong to me, since there's so much ambiguity of what they mean.

At an implementation level, it's a bug if a repr() could be improved to make debugging easier.