python的闭包和JS的闭包不一样吗?
def count(): fs = [] for i in range(1, 4): n = i * i def f(): return n fs.append(f) return fsf1, f2, f3 = count()print f1(), f2(), f3()
def count(): fs = [] for i in range(1, 4): n = i * i def f(): return n fs.append(f) return fsf1, f2, f3 = count()print f1(), f2(), f3()
2020-08-02
举报