string to function reference
embed at NOSPAM.geocities.com
Fri Sep 1 16:42:37 CEST 2000
"Igor V. Rafienko" <igorr at ifi.uio.no> wrote in message
news:xjvem34ibkk.fsf at ganglot.ifi.uio.no...
> I've got a string holding a name of the function in the same module:
> def foo():
> print "I'm foo"
> s = "foo"
> The question is, how do I call the function foo given its name
> All of these approaches are simply waay too ugly, imvho. Does anyone
> see a simpler/cleaner/more elegant way of achieving this.
quoth the buddha:
It is not Python which is not elegant. It is your conception of Python
which is not elegant.
[ I was just re-reading "Zen and the Art of Motorcycle Maintenance" again
last night. He made mention of a class of technical problems referred to by
radio-repairmen as a "short between the earphones". Both funny, and
More information about the Python-list