Separating __cmp__ from < and > ?

Ben Wolfson rumjuggler at cryptarchy.org
Mon Aug 14 21:11:08 EDT 2000


On 15 Aug 2000 00:47:27 GMT, aahz at netcom.com (Aahz Maruch) wrote:

>In article <slrn8ph4ba.u2.hzhu at rocket.knowledgetrack.com>,
>Huaiyu Zhu <hzhu at users.sourceforge.net> wrote:
>>
>>In many situations it is conceptually possible to have a!=b without either
>>a<b or a>b.  Mathematically, this is the case for objects that live in a
>>partially ordered space.
>
>Right.  Problem is, though, that if you have a list of such objects and
>someone does list.sort(), you need to have a way of evaluating the sort
>order.  My suggestion to you is that you define a new set of methods for
>these objects.

But a list.sort() does something even when no __cmp__ method is defined at
all.  Why should it be different when only an __eq__ (or __lt__ or __gt__)
function is defined?

-- 
Barnabas T. Rumjuggler's page of dumbth: members.home.net/rumjuggler

Angels are just a clumsy form of poultry.
 -- A S Byatt, "The Conjugial Angel"



More information about the Python-list mailing list