Ed, I'm not seeing this perceived problem either.

if we have

    >>> d = delayed {'a': 1, 'b': 2}  #  I'm not sure how this is delayed
exactly, but sure
    >>> k = delayed string.ascii_lowercase[0]
    >>> d[k]
    1


I'm not sure how the delayedness of any of the subexpressions matter, since
evaluating the parent expression will evaluate all the way down.

--Josh

On Fri, Feb 17, 2017 at 4:53 PM Ed Kellett <edk...@gmail.com> wrote:

> On Fri, 17 Feb 2017 at 21:21 Joseph Jevnik <joe...@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.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to