__cmp__ used to provide a convenient way to make all ordering operators work by defining a single method. For better or worse, it&#39;s gone in 3.0.<br><br>To provide total ordering without __cmp__ one has to implement all of __lt__, __gt__, __le__, __ge__, __eq__ and __ne__. However, in all but a few cases it suffices only to provide a &quot;real&quot; implementation for e.g. __lt__ and define all the other methods in terms of it as follows:<br>
<br>class TotalOrderMixin(object):<br>    def __lt__(self, other):<br>        raise NotImplemented # override this<br><br>    def __gt__(self, other):<br>        return other &lt; self<br><br>    def __le__(self, other):<br>
        return not (other &lt; self)<br><br>    def __ge__(self, other):<br>        return not (self &lt; other)<br><br>__eq__ and __ne__ are somewhat special, although it is possible to define them in terms of __lt__<br>
<br>    def __eq__(self, other):<br>        return not (self == other)<br><br>    def __ne__(self, other):<br>        return self &lt; other or other &lt; self<br><br>it may be inefficient.<br><br>So, to avoid the situation where all the projects that match <a href="http://www.google.com/codesearch?q=__cmp__+lang%3Apython">http://www.google.com/codesearch?q=__cmp__+lang%3Apython</a> have to implement their own TotalOrderMixin, perhaps one could be provided in the stdlib? Or even better, shouldn&#39;t a class grow automagic __gt__, __le__, __ge__ if __lt__ is provided, and, in a similar vein, __ne__ if __eq__ is provided?<br>