[Numpy-discussion] Truth value of an array

Alan G Isaac aisaac at american.edu
Fri Apr 18 09:20:01 EDT 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