Antoon Pardon wrote:
> It *is* a definition of an ordering.
> 
> For something to be an ordering it has to be anti symmetric and transitive.
> 
> The subset relationships on sets conform to these conditions so it is a 
> (partial)
> ordering. Check your mathematic books, Why you would think this is abuse is 
> beyond me

Which is exactly why a < b on sets returns True xor False, but cmp(a,b) 
throws an exception.

a <COMPARE> b is a local comparison, asking only for the relationship 
between two elements.  In some bases, like the complex numbers, some 
comparisons are ill-defined.; in others, like sets, they're well-defined 
  but don't give a total ordering.

cmp(a,b) asks for their relative rankings in some total ordering.  For a 
space that does not have a total ordering, cmp(a,b) is meaningless at 
best and dangerous at worst.  It /should/ throw an exception when the 
results of cmp aren't well-defined, consistent, antisymmetric, and 
transitive.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to