Whitespace delimiters suck

Quinn Dunkan quinn at pfennig.ugcs.caltech.edu
Fri Jan 21 03:48:06 EST 2000


On Thu, 20 Jan 2000 23:02:43 -0500, Roy Smith <roy at popmail.med.nyu.edu> wrote:
>When I was first learning programming (a quarter of a century ago!), 
>there was the idea of the "telephone test", i.e. your code should be 
>simple enough that if you read it to somebody on the phone they would 
>understand it.  Python not only fails the phone test, it fails the 
>printed page test; I can print two programs on a piece of paper, which 
>differ only in tabs and spaces, and they will appear identical yet which 
>do different things.  Barf.
>
>I'm in love with python, but this idea of white space as significant 
>syntax is the biggest wart on the language by far.

Hey, you're right!  All those times I had to write programs by telling someone
what to write over the phone would have been so much easier if I could have
said "if x equals ten colon y equals three plus x endif" instead of "if x
equals ten colon y equals three plus x dedent".  No, wait, maybe it wouldn't
have.

Let's try again.

All this time I've been writing python by hand on paper, and scanning it in
with an ocr program.. no, uh...  I usually mix tabs and spaces randomly, and
then check programs for syntax errors by printing them out and staring at
them.  It's really hard to find some errors because python is
whitespace-significant.  Why can't some clever person design a syntax-checking
program to do this automatically?  In the process, it could even reduce it to
some unambiguous, machine-friendly level.

Fortunately, python passes the telegraph test:
IF X EQUALS TEN COLON Y EQUALS THREE DEDENT STOP

But it fails the upside-down test and the purple-trashcan test...

As far as simplicity goes that's programmer-dependent.



More information about the Python-list mailing list