title: one line "for" loop in an if test
body: <p>I want to run a series of commands on several elements of a <code>numpy.ndarray</code> that passed an <code>if</code> test.</p>
  
  <p>The <code>if</code> test sets a filter for the lines in the <code>numpy.array</code> that contain the value <code>"nan"</code> (not <code>numpy.nan</code>) and a series of strings defined in a list.</p>
  
  <p>My issue is with the second part of the if test here is basically how I coded it :</p>
  
  <pre><code>d=numpy.array(whatever data)
  filter_list=["..", "..."]
  for line in d:
       if (("nan" not in line) &amp; ([filter_list[i] not in line for i in range(len(filter_list))]):
           "do commands"
  </code></pre>
  
  <p>So the "nan" part is working as expected but the other test is passed whether a ".." or a "..." is found in line or not.</p>
  
  <p>I think the issue comes from the syntax what the second test actually returns is a combination [True/False, False/True] for which the boolean value is always <code>True</code>.</p>
  
  <p>To sum up just focus on the second part of the test : I'd like a 1-line test that checks that none of the defined rejection strings is present in a list of values.</p>