[Numpy-discussion] Truth value of an array

Alan G Isaac aisaac@american....
Fri Apr 18 08:20:01 CDT 2008


On Fri, 18 Apr 2008, Olivier Verdier apparently wrote:
> What is ambiguous about "bool(A==B)"? 

A==B is an array. Compare:

    >>> bool([])
    False
    >>> bool([0])
    True

Even if you decide the second should be false,
what about [0,1]?  (I.e., all or any?)

Cheers,
Alan Isaac





More information about the Numpy-discussion mailing list