getting a value error when trying to compare lists in python
Numpy is not Python!
After p = randint(0, self.size, size=(2, 2))
, p
is a 2D numpy array.
Equality between numpy arrays does not produce a boolean like what is expected for all Python types, but a numpy array of booleans of same dimensions of the compared arrays. In numpy wording, the equality is broadcasted over the array.
Here you probably want: (p[0] == p[1]).all()
. It will be a boolean that is true iif all element of both arrays match.
This numpy feature does make sense because it allows very efficent operations, but is enough to break in
semantics for any Python container that would contain numpy arrays.