Calling a function or method by name

Jason Orendorff jason at jorendorff.com
Wed Jan 23 09:38:27 EST 2002


> In particular, if I have a class with several subclasses, and I 
> want to call a method, how is that done?

method = getattr(object, method_name)
method()

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list