[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)
0
>>> not (a == b)
False
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
eventually.
-tim
More information about the Numpy-discussion
mailing list