What text editor is everyone using for Python

John Yeung gallium.arsenide at gmail.com
Wed May 27 21:41:51 EDT 2009


On May 27, 2:09 pm, Stef Mientki <stef.mien... at gmail.com> wrote:

> John Yeung wrote:
>
> > I kind of marvel at how few people complain about [SciTE's]
> > Python indentation.  (I'd like to think it's because anyone
> > who edits Python code in SciTE has downloaded my patch, but
> > I am confident that is not the case.)
>
> What's not correct about the Python indentation ?
> Where can we find the patch ?

If you have used SciTE for Python and haven't been frustrated by the
autoindentation, then I don't think there is much reason for you to
bother with a patch.  By autoindentation, I mean automatically adding
a level when a new block starts, not merely maintaining indentation
level (which virtually every editor does, and some even call this
their "autoindentation" feature).

The problem with SciTE's autoindentation for Python is that you can
only choose from the following three behaviors:

1.  Add a level if you press Enter on a line containing a "live" colon
(that is, one that's not in a string or comment).  [Try not to use
slices except on the same line as a block-initiating 'for', 'if',
etc.]

2.  Add a level if you press Enter on a line containing selected
keywords like 'if', 'for', 'while', 'def', etc.  [Avoid list
comprehensions and generator expressions.  You can do everything with
map, filter, and lambda, right?]

3.  Don't autoindent at all (maintain the current indentation only).

It boggles the mind that there is no way to tell SciTE "only pay
attention to the colon if it's at the end of the line" other than by
modifying the source code, but there you have it.  (It's not like
choice 3 is actually that bad.  I imagine that is what SciTE's author
uses for Python.)

My patch (which also fixes a couple of other indentation-related
things that were driving me crazy) is here:

  http://groups.google.com/group/scite-interest/files

in the file called Python_AutoIndent.cxx.

John



More information about the Python-list mailing list