A modest indentation proposal

Olaf Delgado delgado at eva17.Mathematik.Uni-Bielefeld.DE
Fri Nov 30 19:06:45 CET 2001


In article <gat-3011010819330001 at 192.168.1.50>, Erann Gat wrote:

[...]
>
>biff()        # Line 0
>for x in l:   # Line 1
>  foo()       # Line 2
>  baz()       # Line 3
># end for
>bar()         # Line 4
>
>What I am suggesting is no different, except that instead of "# end for" I
>want to use ";".  The reason is simple: it's less typing, and it's easier
>to modify emacs python-mode to detect a trailing semicolon than an
>end-block comment.

Yes, but IMO it would be far too easy to mess up the trailing
semicolons when adding lines to or removing lines from the end of a
block. Here's another suggestion: legalize a semicolon on a line by
itself. Thus the code above would look something like this:

biff()        # Line 0
for x in l:   # Line 1
  foo()       # Line 2
  baz()       # Line 3
  ;
bar()         # Line 4

This I think is much easier to keep track of by a human programmer.

The solitary semicolon should be equivalent to whitespace, so code
like

for x in l:
  ;
bar()

would still be illegal.

My two cents.

-- 
   ////         Olaf Delgado Friedrichs, Dept. of Chemistry,
   Olaf         Arizona State University, Tempe AZ 85287, USA
   `='            phone +1-480-965-6570  fax +1-480-965-2747
                  http://www.mathematik.uni-bielefeld.de/~delgado



More information about the Python-list mailing list