keeping Python code properly indented

beliavsky at aol.com beliavsky at aol.com
Thu Jan 15 14:25:30 EST 2004


How do you keep Python code properly indented as you modify it? I use
an Emacs-type editor that has a Python mode, so the initial indenting
is easy. If I later want to put a 'for' loop (or an 'if' statement)
around a bunch of code, I find myself going through the body of the
loop, manually re-indenting to keep the nested loops correct. There
should be a better way.

I think that having a 'for' loop end with a matching 'next' statement,
as done in (for example) Basic, is a safer and clearer way of writing
loops, although some Python programmers consider this a 'feature'
rather than a 'bug'.



More information about the Python-list mailing list