def makeInc (x, step):
def next():
nonlocal x, step
x = x + step
return x
return next
x = makeInc (0, 1)
y = makeInc (0, 10)
x1=x()
x2=x()
y1=y()
y2=y()
print( x1, x2, y1, y2)
输出是 1 2 10 20。我不知道为什么它会给出这些输出,谁能详细解释一下?谢谢!