Numpy.Array in Python list?
To test if an array equal to a
is contained in the list my_list
, use
any((a == x).all() for x in my_list)
If you are looking for the exact same instance of an array in the stack regardless of whether the data is the same, then you need to this:
id(a) in map(id, my_list)