
Oct. 24, 2021
1:46 p.m.
On Sun, Oct 24, 2021, 12:20 AM Chris Angelico
How would it know to look for a and b inside fn2's scope, instead of looking for x inside fn2's scope?
The same way 'eval("a+b")' knows to look in the local scope when evaluated. I mean, of course 'x' could be rebound in some scope before it was evaluated. But a "deferred" object itself would simply represent potential computation that may or may not be performed. If we wanted to use descriptors, and e.g. use 'x.val' rather than plain 'x' , we could do it now with descriptors. But not with plain variable names now.