A very minor proposed improvement to readability of 3.1.2. Strings - 2nd paragraph
“3.1.2. Strings” currently reads like this (emphasis added): In the interactive interpreter, the output string is enclosed in quotes and special characters are escaped with backslashes. While this might sometimes look different from the input (the enclosing quotes could change), the two strings are equivalent. The string is enclosed in double quotes if the string contains a single quote and no double quotes, otherwise it is enclosed in single quotes. The print() function produces a more readable output, by omitting the enclosing quotes and by printing escaped and special characters: Note: the beginning of the paragraph states,” special characters are escaped with backslashes”. This means the characters used to escape special characters escape special characters, the backslashes are not special characters when used to escape special characters. This is shown in the example (the special character is printed because print was used and the backslash was used to escape the special character):
print('"Isn\'t," they said.') "Isn't," they said.
Please note the special character which is escaped is the “ ‘ “ (single quote). The character used to escape the special character is the “backslash” and, as shown in the example, the backslash is not printed. The suggestion is: The print() function produces a more readable output, by omitting the enclosing quotes, by printing escaped special characters, and by not printing the backslashes used to escape special characters: Or The print() function produces a more readable output, by omitting the enclosing quotes, the backslashes used to escape special characters, and by printing escaped special characters: Having it read as it is currently makes it sound like using print then prints escaped and special characters when the only characters which need to be escaped are special characters. Sam Duncan Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
participants (1)
-
Samuel DUNCAN