[Python-Dev] str() for interpreter output

Tim Peters tim_one@email.msn.com
Fri, 7 Apr 2000 21:49:03 -0400


[Guido]
> Thanks for reminding me of what my original motivation was for using
> repr().  I am also still annoyed at some extension writers who violate
> the rule, and design a repr() that is nice to look at but lies about
> the type. ...

Back when this was a hot topic on c.l.py (there are no new topics <0.1
wink>), it was very clear that many did this to class __repr__ on purpose,
precisely because they wanted to get back a readable string at the
interactive prompt (where a *correct* repr may yield a megabyte of info --
see my extended examples from that thread with Rationals, and lists of
Rationals, and dicts w/ Rationals etc).

In fact, at least one Python old-timer argued strongly that the right thing
to do was to swap the descriptions of str() and repr() in the docs!

str()-should-also-"pass-str()-down"-ly y'rs  - tim