Would there be support for a more general cmp/__cmp__

Steve Holden steve at holdenweb.com
Wed Oct 26 01:07:39 CEST 2005


Steven D'Aprano wrote:
> On Tue, 25 Oct 2005 10:09:29 -0400, Christopher Subich wrote:
> 
> 
>>>>By analogy, one can ask, "is the cat inside the box?" and get the answer
>>>>"No", but this does not imply that therefore the box must be inside the
>>>>cat.
>>>
>>>
>>>Bad analogy, this doesn't define a mathematical ordering, the subset
>>>relationship does.
>>
>>Yes, it does.  Consider "in" as a mathematical operator:
>>
>>For the set (box, cat-in-box)
>>
>>box in box: False
>>box in cat-in-box: False
>>cat-in-box in box: True
>>cat-in-box in cat-in-box: False
>>
>>For the set (box, smart-cat) # cat's too smart to get in the box
>>
>>box in box: False
>>box in smart-cat: False
>>smart-cat in box: False
>>smart-cat in smart-cat: False
>>
>>In both these cases, the "in" operator is irreflexive, asymmetric, and 
>>transitive (extend to mouse-in-cat if you really care about transitive), 
>>so "in" is a partial order sans equality.  A useless one, but a partial 
>>order nonetheless.
> 
> 
> What do you mean "in" is a useless ordering? It makes a huge difference
> whether "nuclear bomb in New York" is true or not.
> 
> In fact, I'm quite surprised that Antoon should object to "in" as "this
> doesn't define a mathematical ordering, the subset relationship does" when
> "subset" is just "in" for sets: set S is a subset of set T if for all
> elements x in S, x is also in T. Informally, subset S is in set T.
> 
> Can somebody remind me, what is the problem Antoon is trying to solve here?
> 
> 
Being Belgian, I suspect.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list