On Thu, Jun 20, 2002 at 03:01:06PM -0400, Edmund Lian wrote:
> Ian and Tavis, thanks for the quick reply regarding single versus double
> quoted triplets. Seems to me though, that if the issue is Emacs can't
> understand triple quoted strings that use apostrophes, then Emacs should be
> fixed, not Python source code.
> Once everybody starts going down the path of adapting coding habits to the
> limitations and idiosyncracies of editors, there'll be no end of trouble.
> E.g., "oh, editor X doesn't handle Y well, so let's not use Y either, since
> we did the same for Emacs". I can't see any particular reason why one
> should favor helping Emacs over another editor...
Python syntax highlighting seems to be hard because so many editors have
problems with it. So I'm not surprised if emacs finds the ''' situation
ambiguous. So the choice is to change Python, change the editors, or
adopt a coding style that's friendly to most editors. Python's not
likely to change. Changing emacs requires somebody who understands Lisp
and can also analyze why the algorithm is messing up, which is
intrinsically difficult because ' means different things depending on
context going all the way back to the start of the file. There may be
some Lisp programmers around, but this is a Python community, not a Lisp
community, so there may not be a lot.
I personally use """ for multi-line strings and ''' to block out large
sections of code I don't want executed. The only time I use that is
when I'm making a major structural change or basing one program on
another, and I want the original code in the same file temporarily for
reference. The nice thing about reserving ''' for this
is that it works through triple-quoted strings, so you don't have to
make special arrangements every time a docstring begins or ends.
(Yes, you can use "if 0:", but then you have to indent the whole block
and it must be syntactically correct.)
-Mike (Iron) Orr, iron@... (if mail problems: mso@...)
http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol