For a NumPy array arr, the expression arr in seq returns the element-wise in seq operation, i.e., an array of booleans.
If the resulting array has only one element, then the expression is evaluated as True or False depending on the boolean value of that element. However, whenever you try to evaluate an array with more than one element in boolean context you get a ValueError, as in this case the truth value is ambiguous. You can remove ambiguity through any or all. Run this code to convince yourself:
In [1282]: x = np.array([0])
In [1283]: y = np.array([0, 1])
In [1284]: bool(x)
Out[1284]: False
In [1285]: bool(y)
Traceback (most recent call last):
File "<ipython-input-1285-c0cc820b77c4>", line 1, in <module>
bool(y)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
In [1286]: any(y)
Out[1286]: True
In [1287]: all(y)
Out[1287]: False
If you want to check whether an array is contained in a list you could use NumPy's array_equal like this:
In [1295]: def array_in_list(arr, alist):
...: for item in alist:
...: if np.array_equal(arr, item):
...: return True
...: return False
In [1296]: array_in_list(x, lst)
Out[1296]: True
In [1297]: array_in_list(2*x, lst)
Out[1297]: False
It may be convenient to replace array_equal by allclose in order to avoid the issues associated to floating point comparison.