Separating __cmp__ from < and > ?
Tim Peters
tim_one at email.msn.com
Wed Aug 16 16:58:27 EDT 2000
[Huaiyu Zhu]
> As two others have pointed out, allowing additional __lt__,
> __gt__ would not make __cmp__ worse for use with sort. In
> fact, it might make it better.
FYI, in anticipation of the "Rich Comparisons" proposal (mentioned earlier),
the implementation of list.sort() was changed in 1.5.2 already so that x<y?
is the *only* kind of comparison question it ever needs an answer to. Never
asks about >, >=, <=, == or !=. So instances of a class that defined only
__lt__ would continue to sort fine.
> ...
> PS. I just checked the Rich Comparison PEP and it is empty. Would it also
> suddenly get some contents from nowhere when a discussion reaches some
> conclusion? Maybe this whole PEP business is a ploy to keep outsiders
> out? <0.9wink>
Yes <wink>. Actually, David Ascher is just too busy now. The design of
rich comparisons was worked out in great detail on c.l.py a couple years
ago, long before PEPs were invented. Sending email to him about it would
act as a useful spur to resume it <wink>.
More information about the Python-list
mailing list