title: Python `or`, `and` operator precedence example
body: <p>I cannot produce example in Python which shows Boolean operator precedence rules combined with short circuit evaluation. I can show operator precedence using:</p>
  
  <pre><code>print(1 or 0 and 0)  # Returns 1 because `or` is evaluated 2nd.
  </code></pre>
  
  <p>But the issue with short circuiting shows up when I change it to this:</p>
  
  <pre><code>def yay(): print('yay'); return True
  def nay(): print('nay')
  def nope(): print('nope')
  print(yay() or nay() and nope())  # Prints "yay\nTrue"
  </code></pre>
  
  <p>For each of 4 possibilities when expression before <code>or</code> is <code>True</code> it is the only evaluated expression. If operator precedence works this should print <code>"nay\nnope\nyay\nTrue"</code> or <code>"nay\nyay\nTrue"</code>, with short circuiting, because <code>and</code> should be evaluated 1st.</p>
  
  <p>What comes to mind from this example is that Python reads boolean expression from left to right and ends it when result is known regardless of operator precedence.</p>
  
  <p>Where is my error or what am I missing? Please give an example where it's visible that <code>and</code> is evaluated 1st and it isn't due to code being interpreted from left to right.</p>