Difference between 'is' and '=='

Duncan Booth duncan.booth at invalid.invalid
Mon Apr 3 11:00:38 EDT 2006


Adam DePrince wrote:

> It just happens that the
> logical operation 
> 
>  (a is b ) -> (a == b )
> 
> is always True.

That is incorrect:

>>> inf = 1e300*1e300
>>> nan = inf-inf
>>> nan is nan, nan==nan
(True, False)



More information about the Python-list mailing list