title: Using a list comprehension: Do calculations on elements of lists that are not a string or element of another list
body: <p>I've got two lists l1 and l2 with elements of different types like this:</p>
  
  <pre><code>l1 = [1,2,3,'4']
  l2 = [1,2]
  </code></pre>
  
  <p>I'd like to do calculations of each element in l1 that are not in l2, and not of type string. So I'm wondering if it's possible to isolate integers and strings in a list comprehension somehow.</p>
  
  <p>First of all, here is an example where each element e in l1 is added to itself if e is not in l2:</p>
  
  <pre><code># code
  r = [e+e for e in l1 if e not in l2]
  print(r)
  
  # result
  # [6, '44']
  </code></pre>
  
  <p>Here '4' is repeated and not added since it's a character, but I'd like to ignore that element. So I was thinking that I could isolate elements that had type(e)==int.</p>
  
  <p>A naive attempt:</p>
  
  <pre><code># code
  r = [e+e for e in l1 if type(e)==int not in l2]
  
  # output
  [2, 4, 6]
  </code></pre>
  
  <p>Here, '4' in l1 is ignored seemingly because it's not an integer, but 3 is added to itself even though it's not in l2.</p>
  
  <p>What's going on here (besides the fact that I don't understand list comprehensions)?</p>