[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] python vs lisp
From: |
Bill Page |
Subject: |
Re: [Axiom-developer] python vs lisp |
Date: |
Fri, 30 Mar 2007 16:00:00 -0400 |
User-agent: |
Webmail 4.0 |
Quoting address@hidden:
Python has one major flaw, suffered by all of the lisp-with-parens
languages. Lisp can read, manipulate, and write lisp programs as
data structures in a trivial, natural way. No parser is required.
The program-data equivalence is a non-trivial difference.
This is widely used within Axiom and in a fundamental way.
This would require major design rewrites to accomplish in Python.
Given that they are turing equivalent it is not a theoretical problem.
Actually as Peter Norvig's article points out, Python is really very
similar to Lisp in this respect. Python has
eval(repr(x)) = x
for (most) objects.
Each class defines a __repr__ method which is supposed to provide an
evalable string representation of instances of the class. This is similar
to Axiom's InputForm domain where we also have
interpret(x::InputForm) = x
for (most) domains.
But Axiom rewrites expressions, rewrites them again, turns them into
functions, unparses them, reads and writes them to files, and generally
slices and dices the code in many structural ways. You COULD do this
in Python but you'd get a factor of 10 expansion because you'd
need parsers and compilers for the various intermediate mini-languages.
Python provides built-in tools for object serialization such as pickle and
unpickle:
http://docs.python.org/lib/module-pickle.html
Pickeling and unpickeling quite efficient. It is used for example in the
Zope database that we use for the Axiom wiki website.
Regards,
Bill Page.