问题
What is more preferable way to dynamically call some object's method:
method = getattr(object, name)
method(*args, **kw)
Or
import operator
method = operator.methodcaller(name)
method(object, *args, **kw)
来源:https://stackoverflow.com/questions/7821423/preferable-way-to-dynamically-call-some-objects-method