A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-January/011703.html below:

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

[Python-Dev] Strings: '\012' -> '\n'Guido van Rossum guido@python.org
Mon, 15 Jan 2001 22:24:04 -0500
> I don't know whether this is going to be obvious or controversial,
> but here goes.  Most of the time we're used to seeing a newline as
> '\n', not as '\012', and newlines are typed in as '\n'.
> 
> A newcomer to Python is likely to do
> 
>     >>> 'hello\n'
>     'hello\012'
> 
> and ask "what's \012?" -- whereupon one has to explain that it's an
> octal escape, that 012 in octal equals 10, and that chr(10) is
> newline, which is the same as '\n'.  You're bound to run into this,
> and you'll see \012 a lot, because \n is such a common character.
> Aside from being slightly more frightening, '\012' also takes up
> twice as many characters as necessary.
> 
> 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.

+1 on the idea; no time to study the patch tonight.

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



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4