[Python-ideas] Delayed Execution via Keyword

Joseph Hackman josephhackman at gmail.com
Fri Feb 17 21:14:29 EST 2017

On 17 February 2017 at 20:23, Steven D'Aprano <steve at pearwood.info> wrote:

> > I think it would be key, like async/await, to narrowly define the scope
> in
> > which the word delayed functions as a keyword.
> The PEP makes it clear that's just a transition phase: they will be
> turned into proper keywords in Python 3.7.
> https://www.python.org/dev/peps/pep-0492/#id80
> Python has had "pseudo-keywords" in the past, like "as":
> [steve at ando ~]$ python2.5 -c "import math as as; print as"
> <module 'math' from '/usr/local/lib/python2.5/lib-dynload/math.so'>
> and it is my understanding that the core developers dislike this sort of
> thing. As do I. You shouldn't count as getting the same special treament
> as async/await. Maybe you will, maybe you won't.

Very well put! Do you have any suggestions for doing something in the same
vein? I think there's been a


> That will make it pretty much impossible to tell whether something is a
> delayed "thunk" or not, since *any* attempt to inspect it in any way
> will cause it to reify.
> Maybe that's what we want.

In my mind, this is a plus. The only way to determine if something is
delayed would be something that doesn't apply to anything else, so code
never needs to be aware of delayed.

> Earlier we talked about delayed *expressions* always generating the same
> value, now you're talking about *instances* rather than expressions. It
> makes sense to have keep the standard Python object semantics, rather
> than have the value of a delayed thunk cached by the textual expression
> that generated it.

You are totally right. I agree that the nomenclature is important, and I
think we're on the same page.



I really appreciate the thoughtful feedback! Please let me know if you have
suggestions; I don't expect the idea to be acceptable out-of-the-gate. :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170217/eb832eea/attachment.html>

More information about the Python-ideas mailing list