Design decisions

130. Chained comparisons point one way (2026-11-21)

  • Decision. a < b <= c keeps Python's meaning (each operand evaluated once, links joined by and), as implemented today, but only for chains in one direction: all of </<= or all of >/>=. Mixed directions (a < b > c) and chains containing ==/!= become a compile error suggesting and.
  • Why. 0 <= i < j <= n reads like the statement and costs one comparison per link; mixed chains are almost always a typo and read ambiguously (C++ compiles a < b < c as (a < b) < c).
  • Reverse. Accept every chain again.
  • Status. Accepted; today mixed chains are accepted (print(1 < x > 2) runs), so the checker needs the error plus a compile-fail test.