Calling a function or method by name

Jason Orendorff jason at jorendorff.com
Wed Jan 23 15:38:27 CET 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