Backquotes for deferred expression

All in all, that looks pretty good.

I like the decorator option!

I quite like defer, will see if it sticks.

I think default should be immutable.
And I suspect sooner or later it will need to be worked out whether there is reason to have mutable version at all.

I still think the code would be simpler if back-door was done via simple functions as opposed to needing whole class.

Personally, I don’t mind - it is quite nice from user’s perspective, but if I had to maintain the code, this would be unnecessary complexity. So just heads up for likelihood of that. From what I have seen, “Everything should be as simple as it can be, but not simpler” is a pretty good description of what is usually expected from PR in this respect.

So what is left?
a) Dealing with is. Are there any other similar ones?
b) Function to check if it is defer. Either truetype or isdefer. Or the way that it is, would this work: defer.reveal(obj) is not None? Although this would have overhead?
c) Function to evaluate explicitly. Something like:

def observe(d, maybe=True):
    if maybe and not isdefer(d):
        return d
    return PyObserve(d)

Not sure about observe naming. I used compute, which I took from dask, but I don’t like it very much either. Probably observe is better.

Not sure about naming in general, I guess just stick with anything for now. Look at how much it took to decide on one name here :smiley: Bikeshedding: a method to refresh os.environ. So it is likely that this will be a process in itself once the rest is complete.

1 Like