On 1 March 2014 13:46, Steven D'Aprano
Something perhaps like a thunk might be appropriate? We can *almost* do that now, since Python has a compile function:
thunk = compile("x + 3", "", "eval") # much later eval(thunk)
FWIW, I think this is why PEP 312 (simple implicit lambda) garnered any interest at all: sure, you can't pass such a lambda any arguments, but it works fine as a *closure*. It's also potentially worth trawling the python-ideas archives for the various discussions about deferred and delayed expressions - they're generally all variants of the same basic idea, a less esoteric, easier to learn way to handle one-shot callbacks and other forms of lazy expression evaluation. The "lambda" keyword in the current syntax ends up being a distraction rather than an aid to understanding. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia