Whitespace as syntax (was Re: Python Rocks!)

fcahoon at my-deja.com fcahoon at my-deja.com
Mon Feb 7 19:04:45 EST 2000


In article <860ftk$bas at news.or.intel.com>,
  "tye4" <tye4 at yahoo.com> wrote:
> Indentation is a confusing and lame way to separate what is inside a
block
> and what's outside it.
>
> tye4

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.

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.

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_.

If python code were to become mis-formatted (and given my experience, I
have to believe that sooner or later this _will_ happen) there is _no
way_ to be certain what the original author's intent was, much less to
fix it automatically.  This is a Bad Thing(tm).

I had been taking the "ignore it and it will go away" approach to
Python, because I figure it is no business of mine.  There is no reason
why I can't simply use another language.  However, I was at LinuxWorld
last week, and I think that in over half the sessions I attended the
presenter said at some point "this part was implemented in Python".  (By
contrast, there was only one mention of Perl, and it was dismissive --
"there is an API for perl, but I don't know why anyone would want to use
it".)

So now I'm getting scared that Python will become _status quo_ and we
will soon all have to live with the consequences of this perilous design
decision.  I "woke up and smelled the tabs" as someone in this
monsterous thread suggested -- although to me, that has quite a
different meaning.

Some of you may argue that, if Python is not a good language, how did it
become so popular?  Once a scripting language like Perl or Python
acquires a "critical mass" of followers, it will experience exponential
growth, because the availability of modules affects the usability of the
language in real-world applications and the usability (or rather, use)
of the language leads to the creation of more modules, in a
positive-feedback loop.  Python does address some of the shortcomings of
Perl -- notably, it is far more maintainable in a multi-developer
envirionment -- despite the flawed decision to use whitespace as syntax.
This fact, and a butterfly flapping its wings in the Amazon jungle, has
led Python to achieve "critical mass".

For this "problem" (and please forgive me for posting on _your_
newsgroup that your language is a problem, but I believe that, like me,
many who fear the coming of the python will look here for information) I
have two approaches:

First is the _hardcore_ promotion of realistic alternatives to Python.
I believe that the Ruby language (http://www.ruby-lang.org/) has the OO
advantages of Python without the whitespace-as-syntax deficiency.  (I'll
freely admit that my investigation of both languages is less than it
should be; fact-oriented discussion to enlighten is encouraged.)  Ruby
hasn't achieved "critical mass" yet, but if enough of us see this
"problem" as I do, we can make that happen.

Iff I _must_ live with Python, then I will be driven to my second tactic
-- a comment-driven fix for the lack of adequate information in the the
python source to restore mis-formatted code.  For this I suggest the
comments #{ and #} because they are concise, look like C/Java/Perl, and
can be put on the same line as the first/last statements (obviating the
"it takes an extra line" objection I have read elsewhere in this
thread).

While I'm sure this will strike many of you as a bunch of gratuitous
flamage, I really am only trying to promote reasoned discussion, honest.
I hope no one gets really _personally_ upset!

f



Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list