On Thu, 09 Dec 2010 12:21:45 +0000, Mark Wooding wrote: > John Nagle <na...@animats.com> writes:
>> "sort" has failed because it assumes that a < b and b < c implies a < >> c. But that's not a valid assumption here. >> >> It's not good to break trichotomy. > > You're confused. The property > > a < b and b < c => a < c > > is called `transitivity'. Yes, but I believe that John is referring to the trichotomy (like a dichotomy, only there are three options instead of two) that exactly one of these relations are true: a < b a == b a > b It is true for real numbers, but not for IEEE floats, since none of the three are true if either a or b are a NAN. (Non-IEEE floats could do anything...) [...] > 2. Totality: a <= b or b <= a > > The above list sorting goes wrong because the `float' ordering isn't > total. In particular, x </= NaN and NaN </= x for all x (including x = > NaN!). I believe this is equivalent to trichotomy. > So, your last remark is in the right direction (though strict trichotomy > is unnecessary, as I've mentioned), but apparently only by accident > since the preceding discussion is completely wrong. "Completely" is surely a tad strong -- John might not be using the exact same terminology as you, but he's clearly talking about the equivalent concepts. He wants and expects all data types to either meet a total order, or raise an exception to any of the < > <= and >= operators. -- Steven -- http://mail.python.org/mailman/listinfo/python-list