[Python-3000] Types and classes

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 9 00:55:53 CEST 2008


Terry Reedy wrote:
> Unfortunately, *any* text printed for any object *could* have been the 
> value of a string object.

That's true, but it's sufficiently unlikely that a string
such as "<type 'foo'>" could have accidentally arisen some
other way that I don't lose any sleep over it. If weird
things seem to be happening in some particular case, I'll
put a repr() in to find out exactly what's going on. Most
of the time it's not needed, though.

There's another reason it bothers me. If a string like
"<type 'foo'>" turns up in otherwise normal output, it's
a fairly clear indication that I've somehow ended up
printing something that was never meant to be printed.
Whereas if it just comes out as "foo", it could easily
go unnoticed.

There's something reassuring about the fact that things
with no "obvious" textual representation stick out like
a sore digit when you try to print them. I wouldn't like
to lose that.

-- 
Greg


More information about the Python-3000 mailing list