3 ms·
Not sure I understand, defs have lexical scoping too, if you just read variables (or am I getting rusty?). x = 3 def prt(): print(x) prt() print
by throwaway_pdp09 6y ago
Not sure I understand, defs have lexical scoping too, if you just read variables (or am I getting rusty?).
x = 3
def prt():
print(x)
prt()
prints 3, as expected.
It's when you assign that you need P3's global etc. annotations, and you can't assign in lambdas.