How to handle multi-line quotes

Lie Lie.1296 at gmail.com
Fri Dec 21 15:43:29 EST 2007


On Dec 22, 2:15 am, MartinRineh... at gmail.com wrote:
> Thinking about unclosed multi-line quotes.
>
> When you open a multi-line quote (type '"""') what does your editor
> do? Does it color the remainder of your text as a quote, or does it
> color the line with the open quote as a quote and leave the rest of
> your code alone?
>
> What do you want it to do?
>
> This is a tokenizer question in disguise, of course. The simple way to
> handle it, which is what my editor sees, is for the tokenizer to
> return the remainder of the text as one great UNCLOSED_MULTILINE_QUOTE
> token. The alternative is to assume that the line with the unclosed
> quote is in error and to continue to tokenize the rest. An editor
> might blink or otherwise draw attention to the unmatched quote.

Are you asking about IDLE? If it is, IDLE considers the remainder of
the code as part of multiline-quote and thus colors them green (in
default color scheme). This behavior is consistent with any other code
editors way of handling multiline comments (Frontpage, Dreamweaver,
etc). IMHO, it is a fine behavior, such a huge color change would be
immediately noticed by any non-color-blind people and they'll
immediately close the multiline (perhaps in panic) before filling the
multiline.



More information about the Python-list mailing list