[Tutor] trouble with function-- trying to check
Terry Carroll
carroll at tjc.com
Wed Mar 14 09:04:08 CET 2007
On Wed, 14 Mar 2007, Isaac 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.
The thing is, if the in operator takes precedence than why do
(c == c in "crab")
and
(c == (c in "crab"))
return different results?
More information about the Tutor
mailing list