title: Pythonic way to write for x in Y and not in Z
body: <p>I recently came across a seemingly simple situation, which I could not find a nice pythonic way to write. I wanted to ask SO for their solutions and which would be fastest.</p>
  
  <p>I have two arrays, say <code>Arr1 = [-1, 0, 1, 2, 3]</code> and <code>Arr2 = [1, 2, 3]</code>. I want to get an array of the elements in Arr1 but not in Arr2. Again, super simple situation, but it turned out to be tricky to implement.</p>
  
  <p>I tried variations of <code>[x in Arr1 and not Arr2]</code>, but because <code>not</code> evaluates to a Boolean this raises an error. I feel like python has a really nice and clean solution to this, but it is escaping my mind.</p>
  
  <p>(My solution was <code>filter(lambda x: x not in Arr2, Arr1)</code>. It works, but it isn't a satisfying solution. Does SO have a more pythonic way?)</p>