Operator precedences

Jesper Hansen jesper at funkybuddhas.org
Tue Feb 25 19:04:48 EST 2003


In what order are compare operators evaluated?

According to http://www.python.org/doc/current/ref/summary.html they all
have the same precedence and are evaluated from right to left, but this
does not seem to true in python 2.2.2.

These both evaluate to true, so the order does not seem to be fixed;
(3 < 2 < 1)  ==  (3 < (2 < 1))
(1 < 2 < 3)  ==  ((1 < 2 ) < 3)

What am I missing?

-- 
Jesper Hansen
If at first you don't succeed, destroy any evidence that you ever tried
at all.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030226/4b2396ef/attachment.sig>


More information about the Python-list mailing list