[EMAIL PROTECTED] wrote:

> I swear I am not drunk, but why isn't a1 == a2 and worse why isn't a1
>== a1? Does someone have a clue and can explain to me this suprising
> behavior? (python 2.4.3 on Ubuntu 6.06).

Because the __cmp__ method doesn't return a boolean. It returns a value <0, 
0 or >0 according to the relative ordering of its arguments. You are 
returning True (1) when the values are equal and you should be returning 0. 

If ordering isn't defined for your objects then define __eq__ instead of 
__cmp__.

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

Reply via email to