How to handle multi-line quotes

ianaré ianare at gmail.com
Fri Dec 21 15:38:55 EST 2007


On Dec 21, 2:15 pm, 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.

All the editors I use (Gedit, notepad++, boa contructor) will color
the remainder of the document as a quote until I close it. I would say
keep it that way, but maybe I'm only saying that since I'm so used to
this behavior.



More information about the Python-list mailing list