Python interpreter bug

wittempj@hotmail.com martin.witte at gmail.com
Fri Oct 7 10:19:00 EDT 2005


Your __cmp__ method will always return 0, so all objects will be equal
when you add the method, as Simon and Steve pointed out. The result is
all objects will pass the test of being a member of excluded.
If you do not add a __cmp__ method objects will be compared on identy -
call the id() function to see the identity of an object. An alternative
would be Steve's proposal to compare on the id attribute instead of the
allocated attribute




More information about the Python-list mailing list