vdrab wrote: > Wow, so, to see if I understand correctly: > >>>> r = 0 >>>> s = 0 >>>> t = 100001 >>>> u = 100001 >>>> r == s > True >>>> t == u > True >>>> r is s > True >>>> t is u > False >>>> ... ? > > what the...? > does anybody else get mighty uncomfortable about this?
#include <stdio.h> int main(int argc, char **argv) { int a = 1; int b = 1; printf("a == b: %i\n", a == b); printf("&a == &b: %i\n", &a == &b); return 0; } [EMAIL PROTECTED]:/tmp$ ./test a == b: 1 &a == &b: 0 Feeling the same might uncomfortableness? Get used to it: object identity and two objects being part of an equality-relation are two different beasts. It can get even worse: I can define an object (in C++ as well as in python) that is not even equal to itself. Not that I felt the need for that so far.... So: don't use object identity where you want equality. In all languages. Diez -- http://mail.python.org/mailman/listinfo/python-list