> > > > What's the consensus on this? Is the current dtype behaviour broken? > > It's suboptimal, certainly. Feel free to fix it.
Thankyou. > However, also note > that with ndarray's rich comparisons, such membership testing will > fail with ndarrays, too. This poses a similarly big problem. I can't understand this behaviour either: >>> a = numpy.array([1.2,3.4]) >>> a == 6.5 array([False, False], dtype=bool) >>> a == numpy.array([1,2]) array([False, False], dtype=bool) >>> a == "foo" False >>> a in [1,2,3] Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() Surely this is a bug?! This membership testing operation is quite reasonable. If list.__contains__ is calling ndarray.__eq__(), this ought to succeed. Why does this fail? (and I fail to see how any() or all() can resolve the situation). I need to go check what list.__contains__() is doing... BC _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
