Skip to content

[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

Closed
MagnienSebastien mannequin opened this issue Feb 11, 2019 · 8 comments
Closed

[doc] Slight error in words in [ 2.4.1. String and Bytes literals ] #80143

MagnienSebastien mannequin opened this issue Feb 11, 2019 · 8 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@MagnienSebastien
Copy link
Mannequin

MagnienSebastien mannequin commented Feb 11, 2019

BPO 35962
Nosy @ncoghlan, @lisroach, @remilapeyre

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:

assignee = None
closed_at = None
created_at = <Date 2019-02-11.10:12:39.566>
labels = ['easy', '3.9', '3.10', '3.11', 'type-feature', 'docs']
title = '[doc] Slight error in words in [ 2.4.1. String and Bytes literals ]'
updated_at = <Date 2022-04-08.15:59:25.099>
user = 'https://bugs.python.org/MagnienSebastien'

bugs.python.org fields:

activity = <Date 2022-04-08.15:59:25.099>
actor = 'iritkatriel'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2019-02-11.10:12:39.566>
creator = 'Magnien Sebastien'
dependencies = []
files = []
hgrepos = []
issue_num = 35962
keywords = ['easy']
message_count = 7.0
messages = ['335205', '335493', '335526', '335529', '335530', '335532', '335706']
nosy_count = 6.0
nosy_names = ['ncoghlan', 'SilentGhost', 'docs@python', 'lisroach', 'remi.lapeyre', 'Magnien Sebastien']
pr_nums = []
priority = 'low'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue35962'
versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

@MagnienSebastien
Copy link
Mannequin Author

MagnienSebastien mannequin commented Feb 11, 2019

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'. "

@MagnienSebastien MagnienSebastien mannequin added the 3.7 (EOL) end of life label Feb 11, 2019
@MagnienSebastien MagnienSebastien mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Feb 11, 2019
@csabella csabella added the 3.8 (EOL) end of life label Feb 13, 2019
@lisroach
Copy link
Contributor

The updated line sounds good to me, please make a PR.

@MagnienSebastien
Copy link
Mannequin Author

MagnienSebastien mannequin commented Feb 14, 2019

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?

@remilapeyre
Copy link
Mannequin

remilapeyre mannequin commented Feb 14, 2019

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 https://devguide.python.org/documenting/

If you get lost, please open the PR and tag me in the discussion, I will try and help you.

@remilapeyre
Copy link
Mannequin

remilapeyre mannequin commented Feb 14, 2019

You will find the line you want to change in [Doc/reference/lexical_analysis.rst](https://github.com/python/cpython/blob/main/Doc/reference/lexical_analysis.rst)

@SilentGhost
Copy link
Mannequin

SilentGhost mannequin commented Feb 14, 2019

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.

@ncoghlan
Copy link
Contributor

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.

@iritkatriel iritkatriel added easy 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes and removed 3.7 (EOL) end of life 3.8 (EOL) end of life labels Apr 8, 2022
@iritkatriel iritkatriel changed the title Slight error in words in [ 2.4.1. String and Bytes literals ] [doc] Slight error in words in [ 2.4.1. String and Bytes literals ] Apr 8, 2022
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
nw0 added a commit to nw0/cpython that referenced this issue May 6, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 10, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 10, 2022
@hauntsaninja
Copy link
Contributor

Thanks, seems like the improvements have been made here

ambv pushed a commit that referenced this issue May 16, 2022
ambv pushed a commit that referenced this issue May 16, 2022
hello-adam pushed a commit to hello-adam/cpython that referenced this issue Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir easy type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants