Customisation of comparison operators

Dave Haynes Dave.Haynes at sia-mce.co.uk
Fri Mar 22 16:07:43 EST 2002


Hi,

 Which of __lt__, __le__, __eq__, __ne__, __gt__, __ge__ are used when
sorting lists of objects with <list>.sort()? Which of them is used for
the 'in' and 'not in' comparisons?

 Is __cmp__ no longer used at all if the above are defined?

 This might be dodgy practice, but I have some objects for which I
want to provide subtly different behaviour for the comparison
operators than for testing 'in' and 'not in'...

 Cheers,


               Dave.



More information about the Python-list mailing list