code review

Chris Angelico rosuav at gmail.com
Sun Jul 1 06:20:57 CEST 2012


On Sun, Jul 1, 2012 at 2:07 PM, rusi <rustompmody at gmail.com> wrote:
> Kernighan and Ritchie admit they made a design mistake with their
> operator precedences:
>
> http://en.wikipedia.org/wiki/C_%28programming_language%29#Criticism
>

The examples given there have nothing to do with the chaining of
comparisons and how it's to be interpreted. Yes, "x & 1 == 0" is
evaluated oddly. Doesn't affect "x == 1 == y".

Python's interpretation is more algebraic than C's. That doesn't mean
that C is wrong and Python is right, nor does it mean the converse.

ChrisA



More information about the Python-list mailing list