-
Notifications
You must be signed in to change notification settings - Fork 19
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
dask: Data.all
and Data.any
#373
dask: Data.all
and Data.any
#373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The migration implementation is sound, and the tests have been updated nicely, though before we merge this I think we should discuss the question you pose here in the notes under 'Returned Booleans', because I am not convinced about some cases (see in-line comments) for returning Data
as opposed to the Boolean
in these methods, and would like to hear more about the motivation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidhassell apologies for the delay in reporting back, this fell off my radar after submitting my review. After our discussions last week, my concerns about the return type were quashed, especially from:
-
it being pointed out that
numpy
returns its own custom type for a Boolean, rather than a Python built-inbool
, so there is an appropriate consistency here as you originally saw and implemented:>>> import numpy as np >>> import cf >>> n = np.array([0, 1, 2, 3]) >>> type(n.all()) <class 'numpy.bool_'> >>> type(n.any()) <class 'numpy.bool_'> >>> c = cf.Data(n) >>> type(c.any()) <class 'cf.data.data.Data'> >>> type(c.all()) <class 'cf.data.data.Data'> >>> bool(c.any()) True >>> bool(c.all()) False
-
and from the reference to relevant parts of the array API in dask:
Data.all
andData.any
#373 (comment) which I hadn't properly looked at.
So, overall, I now agree with your behaviour choice and have marked my previously opened comments on the matter as resolved. All good, please merge.
No description provided.