title: What does the unary operator ~ do in numpy?
body: <p>I came across a line of code using Python's numpy that looked like this:</p>
  
  <pre><code>~array([0,1,2,3,4,5,4,3,2,1,0,-1,-2])
  </code></pre>
  
  <p>And it gave the output:</p>
  
  <pre><code>array([-1, -2, -3, -4, -5, -6, -5, -4, -3, -2, -1,  0,  1])
  </code></pre>
  
  <p>Does the unary operator (~) take an array and apply A -> -(A+1) </p>
  
  <p>If so, whats the point?</p>