array.any() and array.all() always returning boolean values?

Hi all, TL;DR: If nobody has concerns, I think we may give always returning boolean values for `any()` and `all()` a shot soon (for object input). Today in the triage meeting, and generally once in a while it comes up that: object_arr.any() object_arr.all() should always return booleans. Currently we have for example: >>> np.array([None, "string"], dtype=object).any() 'string' while we return booleans for anything that isn't an object dtype. Note that our logical reductions, which are used as an implementation: np.logical_or.reduce() np.logical_and.reduce() would still return the old result, so there would be a workaround available (although maybe hard to find). One PR for this is: https://github.com/numpy/numpy/pull/11857 And while I think that may need some tweaks, I think we may push something similar soon (with plenty of time to test before the release) if nobody voices concern. Cheers, Sebastian
participants (1)
-
Sebastian Berg