[Python-ideas] Delayed Execution via Keyword
Ed Kellett
edk141 at gmail.com
Fri Feb 17 16:52:38 EST 2017
On Fri, 17 Feb 2017 at 21:21 Joseph Jevnik <joejev at gmail.com> wrote:
> About the "whatever is d[k]" in five minutes comment: If I created an
> explict closure like: `thunk = lambda: d[k]` and then mutated `d` before
> evaluating the closure you would have the same issue. I don't think it is
> that confusing. If you need to know what `d[k]` evaluates to right now then
> the order of evaluation is part of the correctness of your program and you
> need to sequence execution such that `d` is evaluated before creating that
> closure.
>
If you create an explicit closure, sure. With delayed expressions, you
could explicitly delay d[k], too. If you have an existing d and k,
potentially passed to you by somebody else's code, the delayedness of d and
k should not inflict arbitrarily-delayed sequencing on your attempt to find
out what d[k] is now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170217/a26ef12f/attachment.html>
More information about the Python-ideas
mailing list