merits of Lisp vs Python

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sat Dec 9 07:24:57 EST 2006


On Sat, 09 Dec 2006 00:56:35 -0800, Paul Rubin wrote:

> The syntax is a pretty superficial thing.  The reaction from outsiders
> to Lisp's parentheses and Python's indentation-based structure is
> about the same.  You get used to it either way.

I don't agree. Syntax is significant for human readers, who are the vast
majority of programmers.

Yes, people will get used to most syntax, eventually. But "used to"
doesn't necessarily mean "can read it efficiently". I did a lot of FORTH
coding in my youth, far more lines of code than Pascal, but Pascal was
always easier to read than FORTH for me. Now, I can look at a page of
Pascal code and it is still readable, but the FORTH... urgh.

Most programming languages, yes even FORTH, used indenting for human
readability. They just don't make them syntactically important. Python
just enforces good indenting. 

I've read all the arguments against significant indents/whitespace, or
in favour of braces, and while there are a few minor good points they
make, a few edge cases where Python's significant indentation is
sub-optimal, overall I believe that the famous reaction of programmers to
Python and whitespace is simply them being more like cats than usual:

"It's different, anything different is frightening, I don't like it, hiss
hiss spit!!!"

But Lisp's syntax is so unlike most written natural languages that that it
is a whole different story. Yes, the human brain is amazingly flexible,
and people can learn extremely complex syntax and grammars (especially if
they start young enough) so I'm not surprised that there are thousands,
maybe tens or even hundreds of thousands of Lisp developers who find the
language perfectly readable.

But that isn't to say that the syntax of Lisp is for everybody. Far from
it -- I'd be willing to bet that Lisp developers are a self-selected group
of far above average intelligence. That would explain why so many of them
seem to be so much more comfortable with higher-order functions than most
other people -- even intelligent people. 

(Looking back, I'm embarrassed about my first reaction to factory
functions all those years ago. Hiss hiss spit. But even with added
familiarity, there comes a time where one has to question the benefit of
sufficiently high-order functions. If you are writing a factory function
that returns factory functions that return factory functions that return
the functions that you needed in the first place, chances are you really
need to rethink your tactics.)

If I'm right, then maybe Lisp is "better" in some absolute sense, *for
those who can use it*. For those who can't, it isn't just a matter of
(say) the syntax being hard to read because it is unfamiliar, but it
being objectively harder to use.

An interesting study would be to track people's eyeballs as they read
code, or look at how much oxygen their brain uses. Do Lisp coders do more
work to read Lisp than Python coders do to read Python? I suspect they do,
but successful Lisp coders don't notice. Everybody else does, and
gravitate to languages which might not be "better" but are "good enough".

(If my post leads to any Lisp developer's already swollen head exploding
from pride, my job here is done *wink*)


-- 
Steven.




More information about the Python-list mailing list