title: compare each array element with each list element in python
body: <p>I have a numpy array <code>x =np.array([2,1,0,18, 7, 4, 9])</code>  and a list <code>y=[0, 3, 4]</code>.</p>
  <p>For each element in the array I want to check if it is in the list.</p>
  <p>For this, I will normally do:
  <code>(x == y[0]) | (x == y[1]) | (x == y[2])</code>,  (Equation 1)</p>
  <p>which will give me what I want.</p>
  <p>Now suppose that Equation (1) lies inside a function which take <code>x,y</code> as input.</p>
  <p>My problem is that <code>y</code> can have variable length so, I need a way to automate equation (1), (independant of the length of <code>y</code>).
  Thanks.</p>