title: Logical precedence in Python
body: <p>I have a question about python precedence. I have the following code:</p>
  
  <pre><code>def gcdIter(a, b):
     ans = min(a,b)
     while ((a%ans is not 0) and (b%ans is not 0)):
         ans -= 1
     return ans
  </code></pre>
  
  <p>My question is about the while logical statement. I added several parenthesis just to make sure that the expression would be evaluated the way I was thinking, but is not. The while loop is being breaked before the both expressions are true. Were I'm wrong?</p>
  
  <p>I found a way to do the same thing without using two expressions, in:</p>
  
  <pre><code>def gcdIter(a, b):
     ans = min(a,b)
     while ((a%ans + b%ans is not 0)) :
         ans -= 1
     return ans
  </code></pre>
  
  <p>But I still wanna know why the first code isn't running the way I think it should.</p>