[Python-ideas] Delayed Execution via Keyword

Chris Angelico rosuav at gmail.com
Fri Feb 17 10:45:16 EST 2017


On Sat, Feb 18, 2017 at 2:12 AM, Joseph Hackman <josephhackman at gmail.com> wrote:
> As for what triggers execution? I think everything except being on the right side of an assignment. Even identity. So if a delayed expression would evaluate to None, then code that checks is None should return true. I think this is important to ensure that no code needs to be changed to support this feature.
>
> So for Chris: yes, rand is otherrand not because the delayed instances are the same, but because the value under them is the same, and the is should trigger evaluation. Otherwise code would need to be delayed aware.
>

Interesting. Okay. So in effect, these things aren't objects, they're
magic constructs that turn into objects the moment you do anything
with them, even an identity check. That makes sense.

Can you put deferred objects into collections, or will they instantly
collapse into concrete ones?

ChrisA


More information about the Python-ideas mailing list