string to function reference

Michael Hudson mwh21 at cam.ac.uk
Sat Sep 2 14:25:42 CEST 2000


igorr at ifi.uio.no (Igor V. Rafienko) writes:

> * Alex Martelli
> 
> [snip]
> 
> | The call operation needs to be applied to the function object. The
> | reference to the function object is in a dictionary, under a key you
> | have (the name you hold). What's so "waay to ugly" about fetching
> | the function object from that dictionary, then calling it?
> 
> 
> I was hoping there was already a built-in function that did that.
> Smth. like (symbol-function)

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>

not-sure-whether-this-counts-as-helpful-ly y'rs
M.

-- 
  it's not that perl programmers are idiots, it's that the language
  rewards idiotic behavior in a  way that no other language or tool 
  has ever done                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list