[Tutor] trouble with function-- trying to check

Isaac hyperneato at gmail.com
Thu Mar 15 08:19:29 CET 2007


Hola,

Pardon me if I am repeating others, I think I have read the whole thread
now.

In 5.9 of the Language Reference it says:

"Comparisons can be chained arbitrarily, e.g., x < y <= z is equivalent to x
< y and y <= z"

So this would mean that

item == item in word2

means:

item == item and item in word2

not

(item == item) and (item in word2)

which would first return each value in parentheses and place each value on
either side of the boolean operator [ and ]

Best regards,

-Isaac


Bob said:

Take a look in 5.9 Comparisons in the Language Reference:

"Comparisons can be chained arbitrarily, e.g., |x < y <= z| is
equivalent to |x < y and y <= z|, except that |y| is evaluated only once
(but in both cases |z| is not evaluated at all when |x < y| is found to
be false)."

Applying this to

item == item in word2

yields:

(item == item) and (item in word2)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070315/5b643c72/attachment.html 


More information about the Tutor mailing list