On Fri, Feb 17, 2017 at 9:45 PM, David Mertz <me...@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.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/