John Coleman wrote: > Paul Rubin wrote: > > "John Coleman" <[EMAIL PROTECTED]> writes: > > > > then "x == 3" is false, but "int(x) == 3" is true. > > > But then why is 3.0 == 3 true? They are different types. > > > > The 3 gets converted to float, like when you say > > > > x = 3.1 + 3 > > > > the result is 6.1. > > Yes - it just seems that there isn't a principled reason for implicitly > converting 3 to 3.0 in 3.0 == 3 but not implicitly converting "cat" to > boolean in "cat" == true.
Because being true is not the same as equaling True. == is a test for equaling, not being. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list