我需要返回函数值,为什么我不能用.我想应该能用eval来定义一个函数来返回调用的结果,但是我希望更优雅的方法.


    第二行和第三行可以简写:

    1. result = getattr(foo, 'bar')()