My question is regarding the rules of enclosing scope. In the snippet below if x=x is not passed to the header of F2 there will be an error
def f1():
x = 88
def f2(x=x): # Remember enclosing scope X with defaults
print(x)
f2()
f1()
however I dont understand why "x=x" is not needed in the lambda in the below snippet
def func():
x = 4
action = (lambda n: x ** n) # x remembered from enclosing def
return action
x = func()
print(x(2))