What can you do in LISP that you can't do in Python

John Flynn transpicio at yahoo.com.au
Tue May 15 05:22:59 CEST 2001


"Richard P. Muller" <rpm at wag.caltech.edu> wrote in message
news:3AFFFB0E.70A8B5BF at wag.caltech.edu...
> I read Paul Graham's excellent article
> (http://www.paulgraham.com/paulgraham/avg.html) on using LISP to write
> what became the Yahoo!Stores website. One of the central points is that
> there are some things (macros) that you can do in LISP that you can't do
> in other languages. This motivated me to learn a bit about LISP. I chose
> the Scheme dialect, because it seemed to have the best documentation
> available for free.
>
> However, thus far I can't see anything that I could do in Scheme that I
> couldn't do in Python. From the thread on LISP I've seen a lot of
> comments that have suggested that I should have started with Common Lisp
> instead of Scheme -- so maybe that's the problem. But can someone give
> me a short example of something that I can do in LISP that I couldn't do
> in Python?

from beginner import pinch_of_salt, imho, etc

Others have mentioned the implications of "Turing Completeness". Whatever
you _can_ do in Lisp you _can_ do in Python, but the same goes for
JavaScript (AFAIK(?)). The differences between any two languages are most
meaningful in terms of the styles of thought they encourage and the problems
they solve most conveniently. I think there's quite a lot of overlap between
Lisp and Python, but Lisp definitely provides opportunities for more
fine-grained control over your application, as well as over the language
itself.

These apply to Common Lisp:

* Compile your code and get performance that comes close to C++ without
giving up your dynamic typing and interactive programming. (No matter how
clever you are, you CAN'T do this in Python. Yet!).

* Compile individual functions or whole programs; make changes to a running
program without needing to stop and restart. CL is likely to be more
suitable than Python for large and complex applications when speed is
important, and when rewriting parts of it in C or C++ would be difficult and
time consuming. You can have fast performance, and fast development time
without dropping out of the language that gives you your highest
productivity.

* Use an object system that has multiple dispatch. CLOS (Common Lisp Object
System) has generic functions that are invoked polymorphically according to
the types of one OR MORE of their arguments. (I'm not sure of the value of
this yet, myself. It's certainly changing the way I'm thinking about OOP,
but that's as much as I can say with certainty).

* Create and manipulate symbolic tree-based data structures with the
greatest of ease. (Can be done in Python, of course, but this is central to
Lisp and probably accounts for its widespread use in AI. It profoundly
affects the way you think about knowledge representation).

* Macros make CL a "programmable programming language". For some, that's far
more than they'll ever need. For others, it's close to essential. It depends
on your needs. (I personally have no need for macros, but find I Lisp
remarkably powerful even without them).






More information about the Python-list mailing list