On Mon, 19 May 2008 12:39:36 -0700, destroooooy 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.
That's wrong. Use ``==`` and ``!=`` for testing equality/inequality and ``is`` and ``is not`` for identity testing. And testing for identity is quite rare. Rule of thumb: Use it only for known singletons like `None`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list