What If Python Replaced Elisp?

taashlo at sandia.gov taashlo at sandia.gov
Wed Mar 8 10:23:28 EST 2000


(If you're tempted to post a followup saying something like "Doing
this would be a waste of time and effort", don't.  Just accept that
you've missed the point of this posting and move on.)

This morning I was making some changes to my .emacs file and I thought
how much easier it would be to use Python instead of Elisp for this
purpose.  And that got me to thinking about how appropriate Python
would be in this role.

I'm just beginning to program in Python (I've finished "Learning
Python" and am currently devouring "Python & Tkinter Programming").
And I'm a far cry from an Elisp expert (I know just enough to maintain
my .emacs file).

Now I realize that rewriting XEmacs (my favorite emacsen) to use
Python rather than Elisp would be an enormous undertaking that would
(probably?) not payoff.  But I believe that the mental exercise involved
in thinking about what this would entail would be a good learning
experience about Python's strengths and weaknesses.

So I'll start us off:

Elisp function definitions may be interactive or non-interactive.  If
interactive, then you can use a string to specify how the parameters
are obtained from the user (types, prompts, etc.).  How would this be
done in Python?  (Beginner opinion: I would make all functions
interactive and use a combination of default arguments and explicit
parameter checks.  For example, default an argument to None and check
for this at the beginning of the function, if the argument is None,
then prompt the user for input.  Is there a better way?)

I saw a comparison of Lisp and Python at
<http://www.norvig.com/python-lisp.html> which stated that Lisp can be
about 100 times faster than Python.  I'm going to assume that this
doesn't hold true for Elisp.  But is Python fast enough to be a
scripting engine for an editor?  (Beginner WAG: Python 'feels' just as
fast, if not faster, than Elisp.  But some of the packages
(e.g. font-lock) rely heavily on regular expression parsing, which may
be slower in Python.)

Would it be easier to add a COM (automation) interface to XEmacs if
Python were used instead of Elisp?

Would the GUI be improved by using Tkinter or wxWindows?

What other advangages/disadvantages would arise due to this change?

BTW, are there any extensible editors out there that use Python as
their scripting language?

Thanks,
Tad



More information about the Python-list mailing list