title: Confused about Operator Precedence in Python
body: <p>I was playing around with logical expressions in the python interpreter, and I can't seem to figure out what execution procedure python is really using under the hood. I've seen this table (<a href="http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html" rel="nofollow noreferrer">http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html</a>) as describing the operator precedence that python uses. </p>
  
  <p>1)</p>
  
  <pre><code>print("this") or True and 1/0 and print("tester")
  </code></pre>
  
  <p>when I type that into the python interpreter I get the output of "this" and then zero division error. However, the site I referenced mention that function calls are the second highest precedence, so shouldn't both function calls of print be executed first? I know there's short circuit evaluation, but doesn't that kick in only once you get to the precedence level of the ands, nots, and ors?</p>
  
  <p>2)</p>
  
  <pre><code>True&gt;False or print("hello")
  </code></pre>
  
  <p>even this outputs only True on the python interpreter. why doesn't it do the function call of print first? </p>
  
  <p>3)</p>
  
  <pre><code>5 is 5 or 1/0
  </code></pre>
  
  <p>This outputs True. But shouldn't division have higher precedence than "is" and shouldn't this expression return a ZeroDivsionError?</p>
  
  <p>Can someone explain what I'm missing and how to tell in what order python will execute a logical expression?</p>