[Python-ideas] Automatic total ordering

George Sakkis george.sakkis at gmail.com
Fri Oct 17 03:59:43 CEST 2008

On Thu, Oct 16, 2008 at 8:27 PM, Terry Reedy <tjreedy at udel.edu> wrote:

George Sakkis wrote:
>         I think we've done as much as I am comfortable with doing *by
>>        default*
>>        (i.e. when inheriting from object). The rest should be provided via
>>        mix-ins. But even those mix-ins should wait until 3.1.
>>    After posting and then thinking some more, I came to the same
>>    conclusion, that anything more should be by explicit request.
>> Can you expand on how you reached this conclusion ?
> Some related reasons/feelings:
> 3.0 perhaps completes a major revision of comparisons from default compare
> to default not compare and from __cmp__ based to 6 __xx__s based.  But I
> suspect the full ramifications of this are yet to be seen.  And there may or
> may not be refinements yet to me made.  (Greg's point also.)
> I am not yet convinced that anything more automatic would be completely
> safe.

Neither is the current behavior, and I haven't seen a use case where the
proposal makes things less safe than they already are.

> It seems like possibly one bit of magic too much.

Having total ordering just work by default is too magic ?

If there are multiple sensible magics, better to let the programmer import
> and choose.
> It is hard to take things away once built in.

That's what I take from the whole skepticism, and there's nothing wrong to
becoming more conservative as the language matures. Still It's rather ironic
that the main motivation of introducing rich comparisons in the first place
was to support Numpy, a 3rd party package which most users will never need,
while there is resistance to a feature that will benefit the majority.

Let's focus then on putting out an explicit approach first (for 2.7 and 3.1)
and make it automatic later if there are no side effects. My prediction is
that this will follow a path similar to class decorators, which also didn't
make it initially for 2.4 but were added eventually (yay!).

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

More information about the Python-ideas mailing list