John said:
So I'm wondering, how do you all handle moving around in your code in
cases like this? Is there some sort of consistency to these things that
you can write rules for your text editor to know when to outdent? It
doesn't seem like you can do this reliably, though.
Under windows, I'm using SciTE which is an extremely lightweight editor,
but it handlers "smart unindent": pressing backspace at the beginning of
a line unindents one level, whether you're indenting with tabs (and need
to remove a tab) or space (and need to remove 2, 4, 8 spaces) doesn't
matter. And since SciTE also has Visual Studio's smart home key (home
brings you first at the beginning of the text == current indent, then at
the beginning of the line itself == indent level 0)
SciTE also features "somewhat smart" indent from time to time: it
indents one level after a ":". This is good for if/else/while/..., but
it also indents one level after ":" in dicts, which is way bad.
Oh, and it automatically unindents one level after a "return" statement.
Other than that, SciTE doesn't really "understand" python, if you want a
really pythonic editor you need to check Stani's Python Editor, WingsIDE
or Komodo.