dask: `Data.all` and `Data.any` by davidhassell · Pull Request #373 · NCAS-CMS/cf-python
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
numpyreturns 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 #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.