On Jun 16, 10:29 pm, pirata <[EMAIL PROTECTED]> wrote:
> I'm a bit confusing about whether "is not" equivelent to "!="
>
> if a != b:
>   ...
>
> if a is not b:
>   ...
>
> What's the difference between "is not" and "!=" or they are the same thing?

"is not" is the logical negation of the "is" operator, while "!=" is
the logical negation of the "==" operator.  The difference is equality
versus identity.

>>> a = [1, 2, 3]
>>> b = [1, 2, 3]
>>> a == b
True
>>> a is b
False
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to