Python Versus Whitespace (Re: Best language for graphical apps?)

Christopher Browne cbbrowne at news.hex.net
Tue Aug 31 04:18:17 CEST 1999


On 28 Aug 1999 21:16:49 -0400, Collin W. Hitchcock
<hitchc at vcmr-19.rcs.rpi.edu> wrote: 
> On some earlier date, Christopher Browne <cbbrowne at hex.net> wrote...
>> There seem to be dogmatic positions about the evils of Python's
>> ability to use whitespace to signify control structures;
>> unfortunately, the dogmatic positions seem more often based on blind
>> faith than on tenable arguments.
>
>A list of tenable arguments why I hate white-space syntax dependent
>languages:
>
>   1) A whole slew of trouble with code that uses tabs.  Use your
>   imagination.  Read about the history of "make".

I've never had problems with makefiles, no, never...  :-)

>   2) For bracket grouped languages I prefer the indenting style:
>   
>         block_start
>         {
>           sub_statement
>           sub_statement   
>         }
>   
>   In Tcl it's a syntax error to put the opening bracket on a new
>   line.  In Python the brackets don't exist.  So now I'm looking at
>   someone else's hideous code with 240 column lines.  It's written so
>   that it's completely incomprehensible unless you can see whole
>   lines at a time, so you have to put your editor in wrap mode.  If
>   the brackets exist you can first make sure the code is indented
>   consistently and then look for opened and closed brackets in the
>   same column.  You can filter out all the line wrap garbage when
>   you're looking at block structure.

Analyzing Lisp code is Pretty Easy on a similar basis; the lack of
ambiguity is indeed attractive.

>   3) If you are trying to write a code generator, white-space syntax
>   dependent languages are a nightmare.  So much easier to produce the
>   code without worying about indenting and then run a second program
>   to indent it.

This is *not* one that I see as being a big problem.

In a brace-structured language, you need some structure that counts
braces. 

That parallels the need, in a Python generator, to have some structure
that counts the amount of whitespace in effect.

They're isomorphic to one another.

>4) You can introduce *hideous* bugs by cutting and pasting between
>two differently indented sections of code.  When white space
>doesn't matter, you just paste and tell your editor to reindent.
>
>None of these are deal breakers -- you can work around all of them.
>They just add to the general stress level.  I already have enough
>stress, thankyou.

As you say, these can be worked around.

Thank you for not merely making dogmatic comments; mere dogmatism is
more common in such discussions.
-- 
if (argc > 1 && strcmp(argv[1], "-advice") == 0) {
  printf("Don't Panic!\n");
  exit(42);
}
(Arnold Robbins in the LJ of February '95, describing RCS)
cbbrowne at ntlug.org- <http://www.ntlug.org/~cbbrowne/langscript.html>




More information about the Python-list mailing list