Possible bug in string handling (with kludgy work-around)

Terry Reedy tjreedy at udel.edu
Tue Dec 27 16:38:58 EST 2011


On 12/27/2011 1:04 PM, Rick Johnson wrote:

> But this brings up a very important topic. Why do we even need triple
> quote string literals to span multiple lines? Good question, and one i
> have never really mused on until now.

I have, and the reason I thought of is that people, including me, too 
ofter forget or accidentally fail to properly close a string literal, 
and type something like 'this is a fairly long single line string"
and wonder why they get a syntax error lines later, or, in interactive 
mode, why the interpreter does not respond to a newline.

Color coding editors make it easier to catch such errors, but they were 
less common in 1991. And there is still uncolored interactive mode.

There may also be a technical reason as to how the lexer works.

-- 
Terry Jan Reedy




More information about the Python-list mailing list