I have two numpy arrays containing objects with an overloaded comparison operator that returns another object, instead of True or False. How can I create an array containing the results of the individual comparisons. I would like result to be an array of objects like in the following
lhs = ... # np.array of objects with __le__ overloaded rhs = ... # another np.array result = np.array([l <= r for l, r in izip(lhs, rhs)]) but lhs <= rhs gives me an array of bools. Is there a way to get to the result to be the array of the results of the __le__ method calls without writing a python loop?
np.less_equal(and the other comparison functions) says it returns "the truth value" of the comparison, so it may not be possible to do this without manually iterating over the array.