请教为什么如下编写 return
一个 int
会报错:
TypeError: 'int' object is not callable
而用 lambda
就可以呢?
class Student(object):
def __getattr__(self, attr):
if attr == 'age':
return 25
class Student(object):
def __getattr__(self, attr):
if attr == 'age':
return lambda: 25