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

Eric S. Raymond esr@thyrsus.com
Mon, 15 Jan 2001 23:26:13 -0500

Guido van Rossum <guido@python.org>:
> > > So... i'm submitting a patch that causes the three most common
> > > special whitespace characters, '\n', '\r', and '\t', to appear in
> > > their natural form rather than as octal escapes when strings are
> > > printed and repr()ed.
> > 
> > Works for me.  I'd add \v, \b and \a to cover the whole ANSI C 
> > standard escape set (hmmm...am I missing any?)
> You missed \f [*].  Unclear to me whether it's a good idea to add the
> lesser-known ones; they are just as likely binary gobbledegook rather
> than what their escapes stand for.
> [*] http://www.python.org/doc/current/ref/strings.html

Truth is, Guido, I'm kind of iffy about whether there'd be a gain in
clarity myself.  But I find I'm rather attached to the idea of
maintaining strictest possible symmetry between what Python handles on
input and what it emits on output.

So unless we think adding \f, \v, \b, and \a to the special set would
actually produce a *loss* of clarity relative to octal gibberish (!),
I say do 'em all.  Aesthetically, that feels to me like the right thing, 
and the *Pythonic* thing, to do here.

Have I erred in my intuition, O BDFL?
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

A man who has nothing which he is willing to fight for, nothing 
which he cares about more than he does about his personal safety, 
is a miserable creature who has no chance of being free, unless made 
and kept so by the exertions of better men than himself. 
	-- John Stuart Mill, writing on the U.S. Civil War in 1862