code review

Thomas Jollans t at
Mon Jul 2 16:41:49 CEST 2012

On 07/02/2012 03:28 AM, Steven D'Aprano wrote:
> We *really did have* somebody arguing that chained comparisons are Bad 
> because you can't stick parentheses around bits of it without changing 
> the semantics. That was an actual argument, not a straw-man.

Ahem. It may have been sub-optimally phrased in a way that opened itself
up to attack, but I was arguing that Python comparisons operators are
anomalous because they're not associative.

(and, going back to the root of the argument, this makes them Bad
because "Special cases aren't special enough to break the rules.")

On Sun, 01 Jul 2012 21:50:29 -0400, Devin Jeanpierre wrote:

> On Sun, Jul 1, 2012 at 9:28 PM, Steven D'Aprano
> <steve+comp.lang.python at> wrote:
>> Technically, < in Python is left-associative: a < b < c first evaluates
>> a, not b or c. But it is left-associative under the rules of comparison
>> operator chaining, not arithmetic operator chaining.
> Left-associativity is when a < b < c is equivalent to (a < b) < c.

More information about the Python-list mailing list