Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 347a625

Browse files
committed
Steve Holden <[email protected]>:
Clarify the handling of characters following backslashes in raw strings.
1 parent d5f0198 commit 347a625

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

Doc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Konrad Hinsen
6363
Stefan Hoffmeister
6464
Albert Hofkamp
6565
Gregor Hoffleit
66+
Steve Holden
6667
Gerrit Holl
6768
Rob Hooft
6869
Brian Hooper

Doc/ref/ref2.tex

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -372,19 +372,19 @@ \subsection{String literals\label{strings}}
372372
only)'' in the table above fall into the category of unrecognized
373373
escapes for non-Unicode string literals.
374374

375-
When an `r' or `R' prefix is present, backslashes are still used to
376-
quote the following character, but \emph{all backslashes are left in
377-
the string}. For example, the string literal \code{r"\e n"} consists
378-
of two characters: a backslash and a lowercase `n'. String quotes can
379-
be escaped with a backslash, but the backslash remains in the string;
380-
for example, \code{r"\e""} is a valid string literal consisting of two
381-
characters: a backslash and a double quote; \code{r"\e"} is not a value
382-
string literal (even a raw string cannot end in an odd number of
383-
backslashes). Specifically, \emph{a raw string cannot end in a single
384-
backslash} (since the backslash would escape the following quote
385-
character). Note also that a single backslash followed by a newline
386-
is interpreted as those two characters as part of the string,
387-
\emph{not} as a line continuation.
375+
When an `r' or `R' prefix is present, a character following a
376+
backslash is included in the string without change, and \emph{all
377+
backslashes are left in the string}. For example, the string literal
378+
\code{r"\e n"} consists of two characters: a backslash and a lowercase
379+
`n'. String quotes can be escaped with a backslash, but the backslash
380+
remains in the string; for example, \code{r"\e""} is a valid string
381+
literal consisting of two characters: a backslash and a double quote;
382+
\code{r"\e"} is not a value string literal (even a raw string cannot
383+
end in an odd number of backslashes). Specifically, \emph{a raw
384+
string cannot end in a single backslash} (since the backslash would
385+
escape the following quote character). Note also that a single
386+
backslash followed by a newline is interpreted as those two characters
387+
as part of the string, \emph{not} as a line continuation.
388388

389389
\subsection{String literal concatenation\label{string-catenation}}
390390

0 commit comments

Comments
 (0)