Benefits of moving from Python to Common Lisp?

Paul Rubin phr-n2001d at nightsong.com
Sun Nov 11 16:46:08 EST 2001


"Morten W. Petersen" <morten at thingamy.net> writes:
> I'm currently doing some research, to see if it could be an advantage to
> use Common Lisp instead of Python (currently Python and Zope [1] are used
> to build web applications).
> 
> While doing this, Google has provided two interesting documents (search
> for 'lisp vs python'):
> 
>   http://www.strout.net/python/pythonvslisp.html
>   http://www.norvig.com/python-lisp.html
> 
> First off, to save everyone some time, I'm wondering if there are more
> papers documenting the difference between the two;  if there aren't any,
> I'd like to continue the discussion and summarize the findings in a paper
> accessible on the net.

Norvig's article is pretty good; the Strout article is about a
specific CL implementation and contains a number of errors and
misleading statements, generally favoring Python.  For example, he
says MCL isn't free--however he doesn't mention that there are
numerous free CL implementations.  And he compares Python exceptions
favorably to using catch/throw to simulate exceptions in CL, but he
doesn't mention the Condition system that's been part of CL since
1989, that's more powerful (but more complicated) than Python exceptions.

My own quick comparison: CL is a much more complete system.  Writing
Python code is often an exercise in figuring out how to combine Python
features in some clever way that nobody has done before, to accomplish
your task.  In CL, you more often get the impression that the
designers had anticipated your needs.

On the other hand, CL contains several decades worth of accumulated
junk.  Just about every feature in Python is present in some form in
CL, but Python has a cohesive, smooth design, while in CL the features
feel somewhat bolted on.  Someone once said "APL is like a perfect
crytal--if you add anything to it, it becomes flawed.  Lisp is like a
ball of mud--you can throw anything you want into it, and it's still
Lisp".

Many very large applications have been written in CL.  Zope is one of
the biggest Python applications; by CL standards, it's medium sized (I
think around 150K lines of code).  There are few other Python programs
that come close to being the size of Zope.

Serious CL implementations have real native-code compilers that produce
machine code that runs orders of magnitude faster than Python code.
Someone might add a compiler like that to Python someday, of course.

CL, however, doesn't seem to have changed much in the past decade or
so.  There's no standardization of runtime libraries for doing stuff
like internet programming.  CL feels hopelessly old-fashioned in some
ways.  And to program effectively in CL, you must absorb a lot of Lisp
culture and idioms, almost like learning to speak a foreign human
language.  Programmers experienced in languages like C++ or Perl can
generally read the Python docs and become productive immediately.  Not
many programmers are taking up Lisp these days.  The experienced Lisp
programmers have generally been around for a long time, and there are
getting to be fewer and fewer of them.  As Python matures, I think it
will become more like CL in its capabilities and CL's current
advantages will dimish even more.

To sum up, if you're writing a web application, it's worth considering
CL if the app will be very large or if Python will cause a big
performance problem.  Otherwise, Python is probably a better choice
these days.

You might like reading some of Richard Gabriel's essays on CL at
www.dreamsongs.com.  There's also a Java-to-Lisp comparison somewhere
that you've probably seen.  May of the things it says about Lisp can
probably be applied to Python.



More information about the Python-list mailing list