If I have class A that defines __cmp__, and class B that extends class A, it seems like I have to redefine __cmp__ in class B. Is this correct?
Is there a better workaround than implementing a method “cmp” in class A and calling it from the separate implementations of __cmp__ in class A and class B?
Thanks,
-aj
UPDATE: The issue seems to be my lack of Python 3 exposure. As I read it, __cmp__ should no longer be used: http://docs.python.org/dev/3.0/whatsnew/3.0.html#ordering-comparisons
Instead, I’ve re-implemented my classes using the new ordering comparison operators: http://docs.python.org/dev/3.0/reference/datamodel.html#object.lt
Assuming you have a class called “A”, and that class has a definition for __ cmp __.
And let’s assume you extend class A:
So to retrieve __ cmp __ from class A from within class B one would use:
A.__cmp__from within class BIs my guess.