in case you are trying it in the python shell

 >>> def foo():return "test"
...
 >>> import __main__
 >>> __main__.__dict__["foo"]
<function foo at 0x40420c6c>
 >>> __main__.__dict__["foo"]()
'test'
 >>>

otherwise build your own dict with string->function mapping

op = {
        "plus" : lambda x,y:x+y,
        "minus" : lambda x,y:x-y,
        "power" : lambda x,y:x**y,
}

op["power"](2,8)

hth, Daniel

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to