>>> x = numpy.array([[1, 2],
... [3, 4],
... [5, 6]])
>>> [1, 7] in x
True
>>> [1, 2] in x
True
>>> [1, 6] in x
True
>>> [2, 6] in x
True
>>> [3, 6] in x
True
>>> [2, 3] in x
False
>>> [2, 1] in x
False
>>> [1, 2, 3] in x
False
>>> [1, 3, 5] in x
False
I have no idea how __contains__ works for ndarrays. I couldn't find the relevant documentation when I looked for it. How does it work? And is it documented anywhere?
[1, object()] in xand[object(), 4] in xreportTrue, but[2, object()] in xand[object(), 5] in xreportFalse, and iterating overitertools.product(xrange(1, 7), repeat=2)and checking containment for all pairs gives the expected results. I was really hoping for something better than a mailing list archive, but if that's all there is, I'll take it. - user2357112 supports Monica