Indentation/whitespace

Jon Perez jbperez808 at yahoo.com
Sat Jan 14 03:58:29 EST 2006


Joe wrote:

> As for me, I'm not suggesting that braces are better than indentation.
> In fact, requiring indentation is a good idea, and I agree that braces
> can be quite ugly. It is the lack of visible block closing when there's
> more than one level that I dislike.

> ... I'm talking about double un-indent at the end of a nested loop,
> where the inner-most code is long enough that the end is a double
> dedent. It is especially bad because one persons single dedent can be as
> big as another persons double dedent. I agree with dislikes for brace
> notation, but I think it goes against the argument that Python's way is
> natural and right.

For me, I just feel Python's approach is simple and works.

> If one includes an end-thing for every start-thing, I think it is more
> natural, and still far better than C, but also more verbose.

Indeed.  I don't like unnecessary verbosity.

> In Python, one can use comments where needed, like below, which is what
> I eventually started doing. But, Python is supposed to require 'easy to
> read' code.
>
>    if ...
>      for x...
>        for y...
>          ... lots of code ...
>        #end for
>      #end for
>    #end if

Well doesn't that mean that in Python, you get the best of both worlds?
You can make it verbose if you need the security of closing tokens,
but it is not necessary.

I suspect you may still have some sort of hangover from using C-style
indentation in that you are subliminally not confident that a block
is properly closed unless there is a visible closing token.


> The main thing that I just don't get is why Python promoters are so
> sure that everyone will like the Python syntax once they get used to it.

I myself would never assume that 100% of people will like Python syntax.  But
I know I took to it (including and *especially* the enforced indentation)
like a duck to water, and apparently so do many people.  But then that's
why there are other languages out there. ;-)




More information about the Python-list mailing list