string to function reference

Alex Martelli aleaxit at yahoo.com
Sat Sep 2 15:27:26 CEST 2000


"Michael Hudson" <mwh21 at cam.ac.uk> wrote in message
news:m33djjyo8p.fsf at atrus.jesus.cam.ac.uk...
    [snip]
> You're not missing symbol-function, you're missing find-symbol.
> Python would be a lisp-1 if it were a lisp.
>
> [5]> (symbol-function "REDUCE")
> *** - SYMBOL-FUNCTION: "REDUCE" is not a symbol
> [7]> (symbol-function (find-symbol "REDUCE"))
> #<SYSTEM-FUNCTION REDUCE>

Otoh, eval('reduce') returns a function-object (which
can be applied directly or through apply).  There is no
special datatype 'symbol': the string is mapped
directly to (a reference to) the object it's bound to.  Is
it all that different, all in all...?

    apply(eval('funname'),argslist)


Alex






More information about the Python-list mailing list