On Tue, Feb 17, 2015 at 1:47 PM, Dave Angel <da...@davea.name> wrote: > On 02/17/2015 02:12 PM, boB Stepp wrote: > > See > https://docs.python.org/3.4/reference/lexical_analysis.html#string-and-bytes-literals >> >> >> At this point in the text he is not talking about raw literal strings. >> I examined the author's source and he has obviously inserted at least >> one space between each use of a backslash at the end of a line and the >> EOL terminating characters. > > > Then he's teaching you wrong. Backslash followed by space is not a valid > escape sequence, and to do it at the end of line is particularly odious. I > wouldn't even suggest it in real code, never mind in something that's > published on paper.
I guess I am inclined to cut the author some slack here. The point of his example was NOT to teach escape sequences, but instead show how using keyboard characters you could create a text picture, in this instance of a large "Game Over". He at this point was talking about the print function used with quotes and triple quotes. A little bit later in this same chapter he talks about escape sequences. The point of my original post was to point out that because the author is using a backslash as part of his ASCII art, that unintended consequences might result. I will admit that I was surprised that the author did not think of this potential issue and warn the reader of possible problems, especially as the book is aimed at total beginners. But I suppose it is difficult to anticipate all possible problems. But sure enough, my son stumbled into this one! [...] > I would never intentionally make any trailing whitespace in source code be > significant. And years ago I used an editor that routinely deleted any such > invisible characters. From the rest of your message, it looks like IDLE may > have that behavior. This seems to be the case. On a related note, I wanted to copy and paste the author's source code, showing how he generated the large, "Game Over", but my Gmail keeps collapsing the white space, making the result look like gibberish. So far I cannot find a setting to eliminate this undesired behavior. Argh! -- boB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor