[Python-ideas] If I had the time machine for comparisons

Scott Dial scott+python-ideas at scottdial.com
Fri Oct 14 06:19:34 CEST 2011


On 10/13/2011 10:06 AM, Jim Jewett wrote:
> I think that
> 
>     range(3) < range(10)
> 
> is obviously true

Based on what property? Is that because:

  a) len(range(3)) < len(range(10))

  b) max(range(3)) < min(range(10))

  c) ((min(range(3)) < min(range(10)))
      and (max(range(3)) < max(range(10)))

I guess your argument is that in this degenerate case, all of these
properties are true so it is "obviously true". Personally, if I can't
pin-point the exact reason that "x < y", then it's not obvious even if
for every definition of "<" I can come up with it is a true statement,
because there is not one obvious definition that is true. In other
words, I don't know what "x < y" means for ranges in general so I can't
reason about it in general, therefore this special case is not useful or
obvious. In the absence of explicit arguments to the "<" operand, I
would be baffled as to what to expect as the result.

However, I can understand the desire to test for range equality, and the
definition for that is significantly more obvious.

-- 
Scott Dial
scott at scottdial.com



More information about the Python-ideas mailing list