[Python-Dev] Strings: '\012' -> '\n'

Guido van Rossum guido@python.org
Tue, 16 Jan 2001 09:02:29 -0500


> Yes, i referred to "when strings are printed and repr()ed" as two cases
> because both string_print() and string_repr() have to be changed.
> 
> (Side question: when are *_print() and *_repr() ever different, and why?)

You mean the tp_print and tp_str function slots in type objects,
right?  tp_print *should* always render exactly the same as tp_str.
tp_print is used by the print statement, not by value display at the
interactive prompt.

tp_print and tp_str have differed historically for 3rd party extension
types by accident.

So, string_print most definitely should *not* be changed -- only
string_repr!

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