[Python-ideas] Automatic total ordering
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
> of the 'unimplemented' operations to simply negating their complement. I
> 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...
More information about the Python-ideas