-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inheritance of Purity #2073
Comments
|
oops yes, that was a typo, it still ran since it's treated as a kwarg to a delayed object. I corrected it, thanks! |
For the record, In [6]: myArr = delayed(np.ones, pure=False)((10,10))
In [7]: myArr[0]
Out[7]: Delayed('getitem-f7b0bc2869f1fe6c1221edc2aaac0a73')
In [8]: myArr[0]
Out[8]: Delayed('getitem-f7b0bc2869f1fe6c1221edc2aaac0a73') Would it make sense instead of choosing purity from an absolute standpoint to choose it from a relative inherited standpoint? I don't think |
Just to be clear on terms here, a delayed object does not currently know if it is "pure" or not. Only delayed functions can be labeled as pure. I suspect that the confusion here arises because we use the function Even if we kept the label around it's not clear that the attributes of "pure" objects would themselves be pure. |
I'd be fine with the following:
Thoughts? |
|
Ah, ok, not the last one then. |
Makes attribute access pure on delayed objects, and updates docstring to better reflect this. It is now consistent that all "magic" methods are pure on all delayed objects. Fixes dask#2073.
I applied my proposal above in #2084. I think this is internally consistent, so this approach would be my vote. |
Makes attribute access pure on delayed objects, and updates docstring to better reflect this. It is now consistent that all "magic" methods are pure on all delayed objects. Fixes dask#2073.
Makes attribute access pure on delayed objects, and updates docstring to better reflect this. It is now consistent that all "magic" methods are pure on all delayed objects. Fixes dask#2073.
Thanks, I vote for this as well :-). I like the elaborated documentation, very useful as well! |
Makes attribute access pure on delayed objects, and updates docstring to better reflect this. It is now consistent that all "magic" methods are pure on all delayed objects. Fixes #2073.
(As discussed here: http://stackoverflow.com/questions/42773134/inheritance-of-purity/42773643)
I have a question about inheritance of function purity. For example, consider this case:
I would expect line [6] and [7] to yield the same key, since they are accessing an attribute from a delayed instance declared pure. However, it is not the case, and I must explicitly declare the
getattr
method to be pure for this to work, as seen in lines [8] and [9].As discussed in the stackoverflow link, this seems to be purely an issue of
dask
semantics. I would be inclined to voting for purity to be inherited. But I am a new user, so I would appreciate feedback/comments on this. Thanks!PS: The eventual use case is for dask distributed. It seems that the way purity is treated in this case may possibly be different than the case listed here.
The text was updated successfully, but these errors were encountered: