[Python-ideas] Automatic total ordering

George Sakkis george.sakkis at gmail.com
Fri Oct 17 01:14:49 CEST 2008

On Thu, Oct 16, 2008 at 6:54 PM, Dillon Collins <dillonco at comcast.net>wrote:

On Thursday 16 October 2008, Greg Ewing wrote:
> > It still bothers me that there is no longer a way to
> > provide a single method that performs a three-way
> > comparison. Not only because total ordering is the
> > most common case, but because it makes comparing
> > sequences for ordering very inefficient -- you end up
> > comparing everything twice, once for < and once for =.
> As a note, you can always implement <= as well, thereby reducing the
> overhead
> of the 'unimplemented' operations to simply negating their complement.  I
> do
> this whenever == and < share non-trivial code.

How does this help ? If the result of "<=" is True, you still have to
differentiate between < and == to know whether to stop or proceed with the
next element in the sequence.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20081016/27589624/attachment.html>

More information about the Python-ideas mailing list