
Chris Angelico writes:
It's larger than argument defaults, but also smaller:
Aside: I'm quite confused by your whole line of discussion here, but I'll let Eric follow up.
The overlap with late-bound defaults is the simple case of mutable objects that you want to freshly construct every time, but ultimately, that's not hugely different from a lambda function:
Of course it's hugely different from a lambda function. It will be evaluated at the time of reference, whereas a lambda function will not, it won't be evaluated until called. (This means that to access a deferred object without evaluating it, a separate API will be needed, sort of the dual of function call.)
(Another theoretical difference is that a deferred expression is parsed in the context of its *usage* rather than its *definition*, but that would break all manner of things in Python and is quite impractical.)
I'm a little confused by "theoretical" and "parsed". I guess by "theoretical" you mean that this is a design choice, and by "parsed in the context" you mean that the expression could be represented in the deferred object as a string, an AST, or a code object. Please confirm.