mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Apply character{} markup.
This commit is contained in:
		
							parent
							
								
									3f19b10ca5
								
							
						
					
					
						commit
						83dcf5a290
					
				
					 1 changed files with 17 additions and 16 deletions
				
			
		| 
						 | 
					@ -387,14 +387,14 @@ are generally referred to as \emph{triple-quoted strings}).  The
 | 
				
			||||||
backslash (\code{\e}) character is used to escape characters that
 | 
					backslash (\code{\e}) character is used to escape characters that
 | 
				
			||||||
otherwise have a special meaning, such as newline, backslash itself,
 | 
					otherwise have a special meaning, such as newline, backslash itself,
 | 
				
			||||||
or the quote character.  String literals may optionally be prefixed
 | 
					or the quote character.  String literals may optionally be prefixed
 | 
				
			||||||
with a letter `r' or `R'; such strings are called \dfn{raw
 | 
					with a letter \character{r} or \character{R}; such strings are called
 | 
				
			||||||
strings}\index{raw string} and use different rules for interpreting
 | 
					\dfn{raw strings}\index{raw string} and use different rules for interpreting
 | 
				
			||||||
backslash escape sequences.  A prefix of 'u' or 'U' makes the string
 | 
					backslash escape sequences.  A prefix of \character{u} or \character{U}
 | 
				
			||||||
a Unicode string.  Unicode strings use the Unicode character set as
 | 
					makes the string a Unicode string.  Unicode strings use the Unicode character
 | 
				
			||||||
defined by the Unicode Consortium and ISO~10646.  Some additional
 | 
					set as defined by the Unicode Consortium and ISO~10646.  Some additional
 | 
				
			||||||
escape sequences, described below, are available in Unicode strings.
 | 
					escape sequences, described below, are available in Unicode strings.
 | 
				
			||||||
The two prefix characters may be combined; in this case, `u' must
 | 
					The two prefix characters may be combined; in this case, \character{u} must
 | 
				
			||||||
appear before `r'.
 | 
					appear before \character{r}.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
In triple-quoted strings,
 | 
					In triple-quoted strings,
 | 
				
			||||||
unescaped newlines and quotes are allowed (and are retained), except
 | 
					unescaped newlines and quotes are allowed (and are retained), except
 | 
				
			||||||
| 
						 | 
					@ -402,8 +402,8 @@ that three unescaped quotes in a row terminate the string.  (A
 | 
				
			||||||
``quote'' is the character used to open the string, i.e. either
 | 
					``quote'' is the character used to open the string, i.e. either
 | 
				
			||||||
\code{'} or \code{"}.)
 | 
					\code{'} or \code{"}.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Unless an `r' or `R' prefix is present, escape sequences in strings
 | 
					Unless an \character{r} or \character{R} prefix is present, escape
 | 
				
			||||||
are interpreted according to rules similar
 | 
					sequences in strings are interpreted according to rules similar
 | 
				
			||||||
to those used by Standard C.  The recognized escape sequences are:
 | 
					to those used by Standard C.  The recognized escape sequences are:
 | 
				
			||||||
\index{physical line}
 | 
					\index{physical line}
 | 
				
			||||||
\index{escape sequence}
 | 
					\index{escape sequence}
 | 
				
			||||||
| 
						 | 
					@ -443,12 +443,12 @@ important to note that the escape sequences marked as ``(Unicode
 | 
				
			||||||
only)'' in the table above fall into the category of unrecognized
 | 
					only)'' in the table above fall into the category of unrecognized
 | 
				
			||||||
escapes for non-Unicode string literals.
 | 
					escapes for non-Unicode string literals.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
When an `r' or `R' prefix is present, a character following a
 | 
					When an \character{r} or \character{R} prefix is present, a character
 | 
				
			||||||
backslash is included in the string without change, and \emph{all
 | 
					following a backslash is included in the string without change, and \emph{all
 | 
				
			||||||
backslashes are left in the string}.  For example, the string literal
 | 
					backslashes are left in the string}.  For example, the string literal
 | 
				
			||||||
\code{r"\e n"} consists of two characters: a backslash and a lowercase
 | 
					\code{r"\e n"} consists of two characters: a backslash and a lowercase
 | 
				
			||||||
`n'.  String quotes can be escaped with a backslash, but the backslash
 | 
					\character{n}.  String quotes can be escaped with a backslash, but the
 | 
				
			||||||
remains in the string; for example, \code{r"\e""} is a valid string
 | 
					backslash remains in the string; for example, \code{r"\e""} is a valid string
 | 
				
			||||||
literal consisting of two characters: a backslash and a double quote;
 | 
					literal consisting of two characters: a backslash and a double quote;
 | 
				
			||||||
\code{r"\e"} is not a valid string literal (even a raw string cannot
 | 
					\code{r"\e"} is not a valid string literal (even a raw string cannot
 | 
				
			||||||
end in an odd number of backslashes).  Specifically, \emph{a raw
 | 
					end in an odd number of backslashes).  Specifically, \emph{a raw
 | 
				
			||||||
| 
						 | 
					@ -537,9 +537,10 @@ lexical definitions:
 | 
				
			||||||
             {\token{digit} | "a"..."f" | "A"..."F"}
 | 
					             {\token{digit} | "a"..."f" | "A"..."F"}
 | 
				
			||||||
\end{productionlist}
 | 
					\end{productionlist}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Although both lower case `l' and upper case `L' are allowed as suffix
 | 
					Although both lower case \character{l} and upper case \character{L} are
 | 
				
			||||||
for long integers, it is strongly recommended to always use `L', since
 | 
					allowed as suffix for long integers, it is strongly recommended to always
 | 
				
			||||||
the letter `l' looks too much like the digit `1'.
 | 
					use \character{L}, since the letter \character{l} looks too much like the
 | 
				
			||||||
 | 
					digit \character{1}.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Plain integer decimal literals must be at most 2147483647 (i.e., the
 | 
					Plain integer decimal literals must be at most 2147483647 (i.e., the
 | 
				
			||||||
largest positive integer, using 32-bit arithmetic).  Plain octal and
 | 
					largest positive integer, using 32-bit arithmetic).  Plain octal and
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue