-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
[doc] Slight error in words in [ 2.4.1. String and Bytes literals ] #80143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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 :
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'. " |
The updated line sounds good to me, please make a PR. |
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? |
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 If you get lost, please open the PR and tag me in the discussion, I will try and help you. |
You will find the line you want to change in |
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. |
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. |
(cherry picked from commit 549567c) Co-authored-by: slateny <[email protected]>
(cherry picked from commit 549567c) Co-authored-by: slateny <[email protected]>
Thanks, seems like the improvements have been made here |
(cherry picked from commit 549567c) Co-authored-by: slateny <[email protected]>
(cherry picked from commit 549567c) Co-authored-by: slateny <[email protected]>
…) (pythonGH-92630) (cherry picked from commit 549567c) Co-authored-by: slateny <[email protected]>
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: