Title: Slight error in words in [ 2.4.1. String and Bytes literals ]
Type: enhancement Stage:
Components: Documentation Versions: Python 3.8, Python 3.7, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Magnien Sebastien, SilentGhost, docs@python, lisroach, ncoghlan, remi.lapeyre
Priority: normal Keywords:

Created on 2019-02-11 10:12 by Magnien Sebastien, last changed 2019-02-16 18:01 by ncoghlan.

Messages (7)
msg335205 - (view) Author: Magnien Sebastien (Magnien Sebastien) Date: 2019-02-11 10:12
The documentation reads :

" The backslash (\) character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character. "

However, 'n' does not "otherwise have a special meaning", nor does it represent a new line.

The backslash character does in fact do two different things :

1) It removes special meanings from characters that have one (\\).
2) It assigns a special meaning to normal characters (\n).

A better description would therefore be :

" The backslash (\) character is used to either escape characters that have a special meaning, such as backslash itself, or the quote character - or give special meaning to characters that do not have one, such as 'n', whose escapment '\n' means 'newline'. "
msg335493 - (view) Author: Lisa Roach (lisroach) * (Python committer) Date: 2019-02-14 02:45
The updated line sounds good to me, please make a PR.
msg335526 - (view) Author: Magnien Sebastien (Magnien Sebastien) Date: 2019-02-14 12:28
I'm all up for it; however I only ever worked on small solo projects. I don't really know where to start. Must I clone the whole python repo, or is there maybe a doc repo?
msg335529 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-02-14 13:11
Hi Magnien, if you have already used Git, everything should be familiar.

You have to clone the whole project, but the documentation leaves in the `Doc` folder. There is a lot of information that you can get at

If you get lost, please open the PR and tag me in the discussion, I will try and help you.
msg335530 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-02-14 13:12
You will find the line you want to change in `Doc/reference/lexical_analysis.rst`
msg335532 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2019-02-14 13:58
I don't think that's what the sentence say at all. It says, that a backslash can be used to escape a newline character (not "n"). This refers only to triple-quoted literals and is described in the first row of the table of escape sequences below.
msg335706 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2019-02-16 18:01
I agree the current text is ambiguous given how often folks refer to the newline escape sequence as a "newline", but it isn't wrong - it's just talking about escaping literal newlines in your source code like:

>>> "This is a \
... single-line string"
'This is a single-line string'

When this paragraph is being updated, it would be good to add a cross-reference down to the table of escape sequences later in the section.
Date User Action Args
2019-02-16 18:01:40ncoghlansetmessages: + msg335706
2019-02-14 13:59:33SilentGhostsetnosy: + remi.lapeyre
2019-02-14 13:58:54SilentGhostsetnosy: + SilentGhost, - remi.lapeyre
messages: + msg335532
2019-02-14 13:12:38remi.lapeyresetmessages: + msg335530
2019-02-14 13:11:13remi.lapeyresetnosy: + remi.lapeyre
messages: + msg335529
2019-02-14 12:28:55Magnien Sebastiensetmessages: + msg335526
2019-02-14 02:45:54lisroachsetnosy: + lisroach
messages: + msg335493
2019-02-13 01:44:15cheryl.sabellasetnosy: + ncoghlan

versions: + Python 3.8
2019-02-11 10:12:39Magnien Sebastiencreate