merits of Lisp vs Python

Bill Atkins atkinw at rpi.edu
Sat Dec 9 14:14:27 EST 2006


Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> writes:

> 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!!!"

What about "It's wrong, it's wrong, hiss hiss spit!" ?

I want to be able to change my code and let the editor indent the
result; if I make extensive changes to a section of Python code, I
have to review it afterward and make sure I haven't introduced any
subtle indentation mistakes.  Compare

(let ((x 'blah))
     (if (eql x 'foo)
  (print "blah")
         (print "bloo"))))

This could quite conceivably be the result of a lot of refactoring
of (admittedly silly) code.  But now I just press C-M-q and, pow:

(let ((x 'blah))
  (if (eql x 'foo)
      (print "blah")
      (print "bloo")))

All happily-indented.  And mistakes in nesting show up as mistakes in
indenting.  Who could ask for anything more?  Python requires me to
review the structure of the code to make sure I haven't inadvertantly
broken it.  Why?

Why do I need Python to enforce my indentation (potentially leading to
bugs) when my editor can indent my code perfectly because the syntax
of Lisp is so free of special cases?

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

Most programming languages are nothing like natural languages
(thankfully - ever heard of something called COBOL?).  Lisp's syntax
is trivial to lean, and its semantics are very precise.

> 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*)

I'm afraid you're on the wrong track.  Any programmer can pick up Lisp
and be productive in it these days.  Please don't try to make Lisp
seem more mysterious or elitist than it really is.  It's just a
programming language, and anyone can learn it:

  http://www.gigamonkeys.com/book
 



More information about the Python-list mailing list