[Python-ideas] Delayed Execution via Keyword

Joseph Hackman josephhackman at gmail.com
Fri Feb 17 11:29:58 EST 2017

Pavol: I think that some sort of magic string that is not a string and is actually containing Python code could function, but is less elegant.

ChrisA: I am not sure about collections. I think it may be fine to not special case it: if the act of putting it in the collection reads anything, then it is evaluated, and if it doesn't it isn't. The ideal design goal for this would be that all existing code continues to function as if the change wasn't made at all, except that the value is evaluated at a different time. 


> On Feb 17, 2017, at 10:45 AM, Chris Angelico <rosuav at gmail.com> wrote:
>> 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
> _______________________________________________
> 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/

More information about the Python-ideas mailing list