-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Is this doc wording about raw bytes literal correct? #122701
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
I don't think 'raw bytes' is really correct. It is equivalent to 'raw strs', which also strikes me as wrong. 'Raw' applies to the interpretation of the code literal, not to the resulting Python object.. I believe the sentence in question dates back to 2.6 or 2.7 (git blame would tell). The second 'string' is more generic than the first, encompassing both text and bytes literals (code strings defining sequences of internal character-like sequences). Do you have evidence that some people are really confused? I am not sure how to make the point better. Side note: we have mostly stripped 2.x references from the doc. The last sentence says that in the first sentence, 'literals' means (should be) 'literals without a u/U prefix'. |
…#122702) Co-authored-by: Adam Turner <[email protected]>
…s.rst` (pythonGH-122702) (cherry picked from commit ea70439) Co-authored-by: sobolevn <[email protected]> Co-authored-by: Adam Turner <[email protected]>
…s.rst` (pythonGH-122702) (cherry picked from commit ea70439) Co-authored-by: sobolevn <[email protected]> Co-authored-by: Adam Turner <[email protected]>
…is.rst` (GH-122702) (#122915) gh-122701: Fix wording of raw strings/bytes in `lexical_analysis.rst` (GH-122702) (cherry picked from commit ea70439) Co-authored-by: sobolevn <[email protected]> Co-authored-by: Adam Turner <[email protected]>
…is.rst` (GH-122702) (#122914) gh-122701: Fix wording of raw strings/bytes in `lexical_analysis.rst` (GH-122702) (cherry picked from commit ea70439) Co-authored-by: sobolevn <[email protected]> Co-authored-by: Adam Turner <[email protected]>
…s.rst` (python#122702) Co-authored-by: Adam Turner <[email protected]>
Link: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
I don't think that it is a correct wording. You cannot call
rb''
as a "raw string", it is called "raw bytes". Or "raw bytes literal". Just like the docs docs in the next paragraph:I propose to fix this by using this phrase:
Linked PRs
lexical_analysis.rst
#122702lexical_analysis.rst
(GH-122702) #122914lexical_analysis.rst
(GH-122702) #122915The text was updated successfully, but these errors were encountered: