[Tutor] Discrepancy
Karl Pflästerer
sigurd at 12move.de
Mon Mar 22 10:36:38 EST 2004
An unnamed person wrote:
> what is the problem
>> x =1
>>x is 1
> 1
That may or may not be true.
>> (1 is 1)
> 1
That may or may not be true.
>>x is (1 is 1)
> 0
You mix booleans and numbers. Furthermore you don't seem to fully
understand what `is' is for.
If you're not sure which type of equality you're interested in, use `=='
`is' tests for identity not only equality. The best is you should read
in the Python reference about `is'. There was also in clp a long
discussion about `is' and `=='.
Karl
--
Please do *not* send copies of replies to me.
I read the list
More information about the Tutor
mailing list