[Numpy-discussion] Truth values of arrays:

Tim Hochberg tim.hochberg at cox.net
Fri Mar 3 09:24:10 CST 2006

I'm not a fan of the following behaviour, which I just noticed:

     >>> a = arange(1); b = arange(1)
     >>> cmp(a,b)
     >>> not (a == b)

My feeling is that only shape-() arrays should be usable as truth 
values. Allowing size-1 arrays to be compared as well is just adding a 
weird, not particularly useful, corner case that's going to bite someone 


More information about the Numpy-discussion mailing list