闭包必须与维护对已传递的范围或以前范围中的对象的引用有关。
下面是闭包形式的最简单示例:
def outer(): x=7 def inner(y): return x + y return inner i = outer()