return g和return g()的区别是什么
def count():
fs = []
for i in range(1, 4):
def f(j):
def g():
return j*j
return g #return g可以出结果
r = f(i)
fs.append(r)
return fs
f1, f2, f3 = count()
print f1(), f2(), f3()
与
def count():
fs = []
for i in range(1, 4):
def f(j):
def g():
return j*j
return g() #变成g()就错了
r = f(i)
fs.append(r)
return fs
f1, f2, f3 = count()
print f1(), f2(), f3()