python vs. lisp (whereis quote?)

nbecker at fred.net nbecker at fred.net
Tue Jul 20 10:39:38 EDT 1999


>>>>> "Rolf" == Rolf Marvin Bøe Lindgren <roffe at morgoth.uio.no> writes:

    Rolf> [ nbecker
    Rolf> | One feature of lisp (emacs lisp actually) that I think is pretty cool
    Rolf> | is the "hooks".  A hook is basically unevaluated code that will be run 
    Rolf> | by eval later.
    Rolf> |
    Rolf> | I suspect python lacks this capability.  As I understand it, the only
    Rolf> | similar capability is "eval".  But I think eval expects a string,
    Rolf> | which it will then parse.  While the capability is similar, having to
    Rolf> | parse a string could be inefficient.
    Rolf> |
    Rolf> | Am I correct that what is missing is the ability to postpone
    Rolf> | evaluation using "quote"?

    Rolf> in Lisp, there is no syntactic difference between code and data, and
    Rolf> that is what makes the hook mechanism possible the way it is implemented
    Rolf> in Emacs.  if Python had a way of representing code as data, Python
    Rolf> could have had the same support for hooks. 

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

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




More information about the Python-list mailing list