[Python-ideas] Delayed Execution via Keyword
mertz at gnosis.cx
Sat Feb 18 00:53:49 EST 2017
On Fri, Feb 17, 2017 at 9:45 PM, David Mertz <mertz at gnosis.cx> wrote:
> 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.
> This feels like a disadvantage, and an important one. Most "normal"
> programmers should never have to care whether something is delayed or has
> been concretized already. But people writing debuggers, profilers, etc.
> really do want to know.
> There should be some way at poking at an object if you really want to
> without concretizing it. I wouldn't care if this was some ugly and obscure
> device like 'inspect._is_delayed(my_obj._co_delayed)' that has different
> semantics than other function calls. Maybe "the uglier the better" in this
> case, since it *should* be reserved for special purposes only.
If we assume idempotency (which I'm not certain whether we can/should) then
we could spell the check like this:
if delayed delayed my_obj is delayed my_obj:
print("Yep, it's delayed and I haven't concretized it")
That has the dual advantages of being both ugly and obvious.
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons. Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas