[Zope-dev] __cmp__ methods being ignored?

Benno Rice benno@netizen.com.au
Mon, 13 Dec 1999 11:03:26 +1100


Hi,

I posted about this to -dev a little while ago but received no response.

I've got a Python class that I'm using in Zope, which defines it's own
__cmp__ method.  However this method doesn't appear to be being called
when Zope tests for equality.  Is this a bug or a feature?  Is there
some way I can get around this?

The situation is that I have some of these objects in an array attribute
of another object.  If I try and compare an object that I Acquired to
one that's in the list, it fails as I'm comparing an object of my type
to one of ImplicitAcquirerWrapper.  However, if my __cmp__ method were
being used in the equality test, they'd match (I checked this).

I also tried setting __repr__.  This worked as I'd expect it to but didn't
affect the equality test.

Any help would be most appreciated,  I really need to get this working.

Many thanks.

-- 
Benno Rice                                      "No, no. We're *sweet* and
XNFP Aries Dark Subculture-                      *innocent* evil bastards."
friendly Internet Geek
benno@netizen.com.au                                      "Defend your joy"