Gary Herron wrote:
>
> >>> 100 is (99+1)
> False
>
> >>> 2 is (1+1)
> True
>
> >>> 100 is 100
> True
>
> This is highly implementation dependent. The current (C) implementation
> of Python has a cache for small integers, so the attempt to compare
> values with "is" works for some small integers, and fails for some large
> integers, but curiously, not all instances of comparing large integers.
>

Ahh, thank you. That explains why Fredrick's and Jean-Paul's example
did not work, but mine did (I was using *small* integers). Ok, well I
definitely get the picture. Use the "is" operator for what it was
intended for, or deal with broken code ;-)  Thanks a lot guys.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to