Whitespace delimiters suck

Martijn Faassen m.faassen at vet.uu.nl
Thu Jan 20 21:34:30 EST 2000


tye4 <tye4 at yahoo.com> wrote:
[snip Tim]
> I don't oppose indentation either. It's good for program readability, and
> readability only. It shouldn't be part of the syntax.

But it is -- see below. In just about any language.

Why should it be only for readability? Since programming for readability
is good programming practice, and since it's easy to do without block
delimiters, why not simply take the next step and get rid of this redundancy?

Taking away the whitespace from the redundancy doesn't work -- code becomes
unreadable. So the delimiters were taken away.

> Whitespace end
> delimiters are invisible and hence confusing and prone to error.

                    <---- Lots of invisible whitespace
          ^
          |--- can you see it? :)

Indentation is easier to see than delimiters. It's easy to prove; take away
the indentation and see if you can see which delimiters match which. Now
take away the delimiters and leave the indentation. You know where to put
the delimiters again -- it's usually instantly obvious. If this was not the
case, nobody would use indentation in their code at all.

> I've used some stupid Unix shell languages which fail if I add whitespace:

> Without spaces (this works):
>     $x=10
>     $y=2+2

> With spaces (doesn't work):
>     $x  =  10
>     $y  = 2 + 2

Python is not a unix shell language. That's like saying you've used Lisp and
balancing the braces was difficult so now you think any use of braces 
in programming languages is evil. :)

> I thought they gotten rid of all such languages until I came across Python.
> Good programming languages should be whitespace tolerant, and most of them
> are.
> (C++, Java, Ada, BASIC, HTML, Eiffel, Perl, Pascal, ML etc... really long
> list.)

Why? Why should good programming languages be ignoring whitespace? Many of
these don't, don't, actually -- they use whitespace to split up things into
keywords and variable names and such: <imgsrc="foo"> is not going to work.

Not that HTML is a programming language.

> Why is my question about whitespace raise so many eyebrows? This feature is
> commonplace.

It is because many Python users like this use of whitespace. Just because
most other languages do it differently doesn't mean it is better; if people
reasoned like that we'd still be using lots of balancing braces in every
language, and not just in Lisp (it being one of the first high level
languages). 

Anyway, not your question about whitespace is raising the eyebrows; it's
your sometimes rather inflammatory presentation of this question. You called
a feature of Python that most of us like a lot and think essential to Python
_stupid_, for instance. Generally this is not a good approach to newsgroups.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list