On May 20, 2:39 am, destroooooy <[EMAIL PROTECTED]> wrote:
> I'm wondering what is the canonical usage of the keywords 'is' and
> 'not' when you're writing conditionals and loops. The one I've been
> following is completely arbitrary--I use the symbols '==', '!=' for
> numerical comparisons and the words 'is', 'not' for everything else.
>
> Thanks in advance!
If we're talking in English, it would be like this:

There is a person with a black hair called A
There is another person with a black hair called B
A has a nickname C

All of these statements are true:
A.haircolor == B.haircolor
A is C

but this is NOT true:
A is B # is False

and this is debatable:
A == B

whether A is similar enough to B so that they can be said to be equal
is debatable and depends on the purpose of the comparison (which is
why equality comparison is overridable while identity comparison is
not).
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to