Calling function from a string

Chris Rebert clp at rebertia.com
Mon Dec 8 17:29:01 EST 2008


On Mon, Dec 8, 2008 at 2:23 PM, Robert Dailey <rcdailey at gmail.com> wrote:
> Hi,
>
> I have a string representing the name of a function in Python 3.0. How
> can I call the function name represented by this string *without*
> creating a mapping?

Assuming the function is within scope:

return_val = vars()[the_string](arguments, go, here)

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com

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



More information about the Python-list mailing list