Python indentation

Peter Hansen peter at engcorp.com
Wed Jul 7 15:39:23 CEST 2004


Ville Vainio wrote:

>>>>>>"Sateesh" == Sateesh  <ext-sateesh.kavuri at nokia.com> writes:
>     Sateesh> Why can't the indentation not so strict so as to give
>     Sateesh> better freedom to the user?
> 
> You already have all the freedom you need. You can indent with 1
> space, or 56 spaces if that strikes your fancy. Why would you want the
> freedom to indent inconsistently?

Oh, believe me, some people do want that (though, I hope, not
Sateesh... he sounds more sensible :-).  I once had a fellow
working for me who, as it turned out, would indent effectively
arbitrary amounts each time he started a new block.  We
were so astounded that several of us clustered around him to
watch him do it.  He was quite amenable to the audience, too,
as he saw nothing wrong with it.

He would type (this was in C), say, an 'if' statement and its
expression.  Then he would hit Enter and hold down the space
bar for a second or two.  Generally he'd end up at least five
or ten spaces past the previous line's indentation.  Sometimes
it was 25 spaces.  The blocks for the 'if' and the 'else'
would rarely align, and if they did it was mere serendipity.

As it shortly turned out, the fellow was an iceberg, and
once we discovered the other 90% lurking below the surface,
and the seriously negative effect it had on his code (which
was all but unreadable to the rest of us, not to mention
just plain scary bad), we ditched him pretty quick.

The ironic thing is that he could just as easily have done
this with Python -- he was at least consistent within a
block...

-Peter



More information about the Python-list mailing list