funcs = ['fetch_data_' + i for i in ( 'activities', 'banners', 'server_list')]# from operator import methodcaller# f=lambda fn:methodcaller(fn)(self)f = lambda fn: getattr(self, fn)()
在Python中,对这两个东西有明确的规定: 函数function —— A series of statements which returns some value to a caller. It can also be passed zero or more arguments which may be used in the execution of the body. 方法method —— A function which is defined inside a class body