On Sun, Nov 06, 2016 at 09:31:06AM -0500, Eric V. Smith wrote:
> The point remains: do we want to be able to create unevaluated
> expressions that can be evaluated at a different point?
I sometimes think that such unevaluated expressions (which I usually
call "thunks") would be cool to have. But in more realistic moments I
think that they're a solution looking for a problem to solve.
If your PEP suggests a problem that they will solve, I'm interested.
But note that we already have two ways of generating thunk-like objects:
functions and compiled byte-code.
thunk = lambda: a + b - c
thunk()
thunk = compile('a + b - c', '', 'single')
eval(thunk)
Both are very heavyweight: the overhead of function call syntax is
significant, and the keyword "lambda" is a lot of typing just to delay
evaluation of an expression. compile(...) is even worse.
--
Steve
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/