[Python-ideas] Delayed Execution via Keyword

Ed Kellett edk141 at gmail.com
Fri Feb 17 14:26:00 EST 2017

I think trying to eager-ify subexpressions is absurdly difficult to do
right, and also a problem that occurs in other places in Python already, so
solving it only for this new thing that might very well go no further is a
bit odd.

I don't think versions that aren't transparent are much use.

> 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.

This seems unfortunate. Why not make these things objects that replace
themselves with the evaluated-to object when they're used?

> "this collapses the waveform, that keeps it in a quantum state"

That's a bit of a false dichotomy ;)

I suggest that operators on delayed-objects defer evaluation iff all of
their operands are delayed, with some hopefully-obvious exceptions:
- Function call: delayed_thing() should evaluate delayed_thing
- Attribute and item access should evaluate the container and key: even if
both operands are delayed, in Python we have to assume things are mutable
(especially if we don't know what they are yet), so we can't guarantee that
delaying the lookup is valid.

Just passing something to a function shouldn't collapse it. That'd make
this completely useless.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170217/206e6205/attachment.html>

More information about the Python-ideas mailing list