On 11/10/05, Chris Fonnesbeck <fonnesbeck@gmail.com> wrote:
On 11/7/05, Travis Oliphant <oliphant@ee.byu.edu> wrote:
Steven H. Rogers wrote:
OK. I can't think of a really good use case for using an array as a truth value. I would argue though, that it would make sense for an array of zeros to be False and an array with any non-zero values to be True.
I agree this makes sense. That's why it used to be the default behavior. But you can already get that behavior with any(a).
There will be many though, I'm afraid, who think b or a ought to return element-wise like b | a does. This is not possible in Python. Raising an error will at least alert them to the problem which might otherwise give them misleading results.
I'm not quite sure how any() is supposed to work; does it just return true if one or more element evaluates to true?
In my current code, I have the following:
if sum(lower>=median or median>=upper): <do something>
which returns a ValueError. What is the best way to detect elements in one array that are less than the corresponding element in the other without constructing a list comprehension?
I think I see the problem. Under scipy_core, this now needs to be: if sum(lower>=median) or sum(median>=upper): <do something> -- Chris Fonnesbeck Atlanta, GA