[Python-ideas] Delayed Execution via Keyword

Joseph Jevnik joejev at gmail.com
Fri Feb 17 14:38:16 EST 2017

Delayed execution and respecting mutable semantics seems like a nightmare.
For most indexers we assume hashability which implies immutability, why
can't we also do that here? Also, why do we need to evaluate callables

re the thunk replacing itself with the result instead of memoizing the
result and living as an indirection: This is most likely impossible with
the current memory model in CPython. Not all objects occupy the same space
in memory so you wouldn't know how much space to allocate for the thunk.
The interpreter has no way to find all the pointers in use so it cannot
just do pointer cleanups to make everyone point to the newly allocated

On Fri, Feb 17, 2017 at 2:26 PM, Ed Kellett <edk141 at gmail.com> wrote:

> 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.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170217/84505746/attachment.html>

More information about the Python-ideas mailing list