Whitespace as syntax (was Re: Python Rocks!)

Bijan Parsia bparsia at email.unc.edu
Mon Feb 7 22:27:37 EST 2000


<fcahoon at my-deja.com> wrote:

[snip]
> I am not a Python user for this very reason, and I know many developers
> who are interested in the buzz about Python but when they hear "Python
> uses whitespace as syntax" refuse to touch it.

Er... almost every language uses whitespace as syntax, usually for token
delimitation (is that the word?). I believe that Fortran didn't use
whitespace as syntax. Ick.

Oh oh oh. You mean use whitespace as *block* delimiters. Yes, Python and
several other languages use that to some degree, Python rather deeply
and consistently.

So you should point out to those developers that it's *not at all* like
Fortran, and they should take a look and maybe a touch before tossing
it.

> I am a C programmer who works in an environment where many coders have
> come and gone, and some were better than others.  Different tab
> conventions have been used in different places in the codebase, and
> sometimes tabs have been converted to spaces incorrectly as well --
> leaving a horrible mess.

Sure. Of course, there was no compiler based mechanism enforcing
consistent levels of indentation, was there? That *might* make a
difference, eh?

I think, notwithstanding your experience with C (though why that should
be applicable to Python...), *you* have a riddle to answer: There is a
*lot* of Python code out there. The standard distribution contains loads
of modules from many different sources. You *yourself* indicate that
Python is becoming common place....

....*if* keeping Python block structure working were such a difficulty,
don't you think someone might have noticed by now? Given that it's
pretty much only a problem in a few, well defined places, why are you so
worried aobut it?

> Fortunately it is easy to fix this with a pretty-printing program (I use
> "M-x indent-region" in emacs).  That is because the information required
> to fix the indentation _is present in the file_.

Not if the curly brace eating nano-virus strikes!

> If python code were to become mis-formatted (and given my experience, I
> have to believe that sooner or later this _will_ happen)

Er...not your experience of *Python* code, right? So, your experience
with Python code: 0. Everyone elses: >0 (some up to, what, 8 years? 10
years?). I think it more correct that your *lack* of (relevant)
experience leads you to your belief.

Cheers,
Bijan Parsia.



More information about the Python-list mailing list