A modest indentation proposal

Neil Schemenauer nas at python.ca
Fri Nov 30 21:42:00 CET 2001


Erann Gat wrote:
> My point is that there is not enough information at the moment for a
> smarter editor to do the Right Thing with.  The information just isn't
> there.

In this code:

    if x:
        foo()
    bar();

your proposed extra information says that bar() should only be called if
x is true.  I propose that the information is also present in this code:

    if x:
        foo()
        bar()

The relevant information is the four spaces before the characters
"bar()".  How is a semicolon at the end of a statement better than
indentation before a statement?  The second bit of code seems clearer
and cleaner to my eyes.  Perhaps I've been writing Python code too long
and have been brainwashed by Guido. :-)

What problem are you trying to solve with the extra semicolon?  If it's
to make copy and pasting code easier I find that using the block indent
feature of my editor works well.  When I paste a chunk of code I ident
to de-indent things until it looks right.

  Neil




More information about the Python-list mailing list