As far as I can tell: because (c in "crab") membership is in parentheses it is more binding than the [==] comparison. That is why it returns true/false first.
I incorrectly wrote before: " The [in] operator takes precedence" http://docs.python.org/ref/summary.html -Isaac On 3/14/07, Isaac <[EMAIL PROTECTED]> wrote:
a, b, c, or d is a type('str') not boolean which is what (c in "crab") is. The [in] operator takes presedence, the first 3 times (c in "crab") returns true and the last returns false; but the strings a, b, c, or d do not == true or false - therefore the test (c == (c in "crab")) always returns false. (I think) cheers -Isaac reference: http://docs.python.org/ref/summary.html Terry wrote: >>> for c in "abcd": ... print (c == c in "crab"), (c == (c in "crab")) ... True False True False True False False False
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor