Method call from string

ZnU znu at znu.dhs.org
Fri Jun 7 01:31:10 EDT 2002


Say I've got a variable with the value 'do_something', and I have an an 
object that happens to have a do_something method. How can I call that 
method based on the value of the variable? Preferably without using 
eval() or similar.

I can't turn up anything about this on Google or in the documentation 
I've searched, but maybe Python just doesn't use the terminology I know 
from Objective-C.

-- 
Right now the Internet gives an awfully good imitation of providing superhuman
intelligence capability, both in terms of the total hardware that is out there
and the fact that the 'net has all these human-equivalent peripheral devices
called "users" that can be appropriated in a distributed way to attack problems.
                    --Vernor Vinge



More information about the Python-list mailing list