python dynamic function call on object code example
Example: python calling dynamic function on object
obj = MyClass()
try:
func = getattr(obj, "dostuff")
func()
except AttributeError:
print "dostuff not found"
obj = MyClass()
try:
func = getattr(obj, "dostuff")
func()
except AttributeError:
print "dostuff not found"