Repository navigation
gh-160886: Doc: Clarify newline escaping in triple-quoted strings - #160887
prodehghan wants to merge 1 commit into
Conversation
Documentation build overview
|
| where unescaped newlines are otherwise preserved. It allows long string | ||
| literals to be split across source lines without adding newline characters | ||
| to the resulting string. Alternatively, the same result can be achieved | ||
| using parentheses and :ref:`string literal concatenation <string-concatenation>`. |
There was a problem hiding this comment.
As I said on the issue, I think the proper fix is to fix the reference so that it points to section 2.5.1. Triple-quoted strings, which has the sentence "Unescaped newlines are also allowed and retained", instead of to the generic 2.5. String and Bytes literals.
After adding new reference target line ..triple-quoted-strings after the current index line 677 single: '''; string literal, fix the link here and otherwise leave the line alone:
| using parentheses and :ref:`string literal concatenation <string-concatenation>`. | |
| The same result can be achieved using :ref:`triple-quoted strings <triple-quoted-strings>`, | |
| or parentheses and :ref:`string literal concatenation <string-concatenation>`. |
I am presuming that hyphens are correct for multi-word targets.
There was a problem hiding this comment.
Thanks for the review. Please see my comment on the PR.
I updated the text and fixed the reference.
I added a reference label for the "Triple-quoted strings" subsection, but I'm not sure that's the only way we can reference the subsection. Can we do it without introducing a label?
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Clarify that unescaped newlines are preserved in triple-quoted strings and that `"\<newline>"` omits them in non-raw string literals. Retain string literal concatenation as an alternative.
c33f25e to
969876e
Compare
Clarify that unescaped newlines are preserved in triple-quoted strings and that
"\<newline>"omits them in non-raw string literals. Retain string literal concatenation as an alternative.