title: How to perform element-wise Boolean operations on NumPy arrays
body: <p>For example, I would like to create a mask that masks elements with value between 40 and 60:</p>
  <pre><code>foo = np.asanyarray(range(100))
  mask = (foo &lt; 40).__or__(foo &gt; 60)
  </code></pre>
  <p>Which just looks ugly. I can't write</p>
  <pre><code>(foo &lt; 40) or (foo &gt; 60)
  </code></pre>
  <p>because I end up with:</p>
  <pre><code>  ValueError Traceback (most recent call last)
    ...
    ----&gt; 1 (foo &lt; 40) or (foo &gt; 60)
    ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
  </code></pre>
  <p>Is there a canonical way of doing element-wise Boolean operations on NumPy arrays with good looking code?</p>