python vs. lisp (whereis quote?)

Johann Hibschman johann at physics.berkeley.edu
Tue Jul 20 17:22:15 EDT 1999


nbecker  writes:
>>>>>> "Rolf" =3D=3D Rolf Marvin B=F8e Lindgren <roffe at morgoth.uio.no> wri=

Rolf> if eval expects a string, and if the string can contain code,
Rolf> then you have it, haven't you?

> Sort of - but it has to be parsed - so it may not be very efficient.

Just pass a function.  It's easy.

def hook_fcn (x):
  do_something_with (x)

register_hook (hook_fcn)

Or use a class, with some defined "hook" methods.

class Hook:
  def call (self):
    # override me in subclasses!
    return None

Emacs lisp is a bad ancient ugly dialect of lisp.  I'm waiting for the
day they port the whole thing over to either Scheme or Common Lisp.
The whole "quote things then eval later" seems much more complicated
than it has to be.

-- 
Johann Hibschman                           johann at physics.berkeley.edu




More information about the Python-list mailing list