Python vs. Lisp -- please explain

DH no at spam.com
Sun Feb 19 00:35:27 EST 2006


63q2o4i02 at sneakemail.com wrote:
> A few years ago I
> had an AI class where we had to use Lisp, and I absolutely hated it,
> having learned C++ a few years prior.  They didn't teach Lisp at all
> and instead expected us to learn on our own.

CS classes haven't changed, I see.

> In learning Python I've read more about Lisp than when I was actually
> trying to learn it, and it seems that the two languages have lots of
> similarities:
> 
> http://www.norvig.com/python-lisp.html
> 
> I'm wondering if someone can explain to me please what it is about
> Python that is so different from Lisp that it can't be compiled into
> something as fast as compiled Lisp?  From this above website and
> others, I've learned that compiled Lisp can be nearly as fast as C/C++,
> so I don't understand why Python can't also eventually be as efficient?
>  Is there some *specific* basic reason it's tough?  Or is it that this
> type of problem in general is tough, and Lisp has 40+ years vs Python's
> ~15 years?

It is by design. Python is dynamically typed.  It is essentially an 
interpreted scripting language like javascript or ruby or perl, although 
python fans will be quick to tell you python is compiled to byte code. 
They'll also be quick to tell you:
-python has true closures (although nothing like ruby's blocks)
-is beginner friendly (despite being case sensitive and 3/4==0, for example)
-is not, in fact, slow at all (despite benchmarks as you noted showing 
otherwise).
Judge for yourself.

There are projects that combine static typing + the python syntax, which
result in dramatically faster code, but perhaps only 80% of python's
functionality and less flexibility you get from dynamic typing. 
Projects like shedskin.  But some python fans don't think 80% cuts it, 
even if you do get a 100 fold speed increase.



More information about the Python-list mailing list