[Python-Dev] str() for interpreter output

Guido van Rossum guido@python.org
Fri, 07 Apr 2000 16:14:53 -0400


> Guido van Rossum wrote:
> > However, it may be time to switch so that "immediate expression"
> > values are printed as str() instead of as repr()...

[Ping]
> You do NOT want this.
> 
> I'm against this change -- quite strongly, in fact.

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.  Note that xrange() commits this sin!  (I didn't write
xrange() and never liked it. ;-)

We still have a dilemma though...  People using the interactive
interpreter to perform some specific task (e.g. NumPy users), rather
than to learn about Python, want str(), and actually I agree with them
there.

How can we give everybody wht they want?

> As for the suggestion to add an interpreter hook to __builtins__
> such that you can supply your own display routine, i'm all for it.
> Great idea there.

Maybe this is the solution...

--Guido van Rossum (home page: http://www.python.org/~guido/)