[Python-Dev] Re: Re: lists v. tuples (original) (raw)

Greg Ewing greg@cosc.canterbury.ac.nz
Wed, 16 Apr 2003 13:11:34 +1200 (NZST)


Yes, I know that -1 is a valid truth value.

So the first time you care is the first time f(x, y) returns nonzero. Now you can find out what kind of function f is by calling f(y, x). If f(y, x) returns zero, f is <. Otherwise, it's a 3-way comparison.

I think the worry is that the function might be saying "true" to both of these, but just happen to spell it 1 the first time and -1 the second.

Probably fairly unlikely, though...

Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+