I want to be able to call different methods in a Python class with a dynamic function name, e.g.
class Obj(object): def A(self, x): print "A %s" % x def B(self, x): print "B %s" % x o = Obj()
What is the "foo"? (or is there some other approach?) I'm sure it should exist, but I just can't find it or remember what it is called. I looked at getattr , apply and others in built-in functions . This is such a simple reference question, but alas, here I am!
Thanks for reading!
python reflection methods
Brian M. hunt
source share