title: Precedence of chained comparisons?
body: <p>I'm wondering how Python parses:</p>
  
  <pre><code>not a &lt; b &lt; c
  </code></pre>
  
  <p>It seems to interpret this as:</p>
  
  <pre><code>not (a &lt; b &lt; c)
  </code></pre>
  
  <p>as opposed to <code>(not a) &lt; b &lt; c</code></p>
  
  <p>This question explains grouping vs chaining:
  <a href="https://stackoverflow.com/questions/25753474/python-comparison-operators-chaining-grouping-left-to-right">Python comparison operators chaining/grouping left to right?</a> but what are the rules for the precedence of chained comparisons?</p>
  
  <p>It's strange to me that <code>not</code>, <code>&lt;</code> and <code>&gt;</code> have the same precedence, but <code>not a &lt; b &lt; c</code> parses as <code>not (a &lt; b &lt; c)</code> while <code>-a &lt; b &lt; c</code> parses as <code>(-a) &lt; b &lt; c</code>.</p>
  
  <p>I tested this by evaluating <code>not 2 &gt; 1 &gt; 2</code> in Python 2.7.</p>