[Python-Dev] (Don't Read If You're Busy With 2.1b2) "Rich" Comparisons?

Moshe Zadka moshez@zadka.site.co.il
Fri, 23 Mar 2001 22:30:12 +0200


On Fri, 23 Mar 2001 14:20:21 -0500, Guido van Rossum <guido@digicool.com> wrote:

> > >>> a = set([1,2])
> > >>> b = set([1,3])
> > >>> a>b
> > 0
> > >>> a<b
> > 0
> 
> I'd expect both of these to raise an exception.
 
I wouldn't. a>b means "does a contain b". It doesn't.
There *is* a partial order on sets: partial means a<b, a>b, a==b can all
be false, but that there is a meaning for all of them.

FWIW, I'd be for a partial order on complex numbers too 
(a<b iff a.real<b.real and a.imag<b.imag)

> > >>> max(a,b) == a
> > 1
> > 
> > While I'd like
> > 
> > >>> max(a,b) == set([1,2,3])
> > >>> min(a,b) == set([1])
> 
> You shouldn't call that max() or min().

I didn't. Mathematicians do.
The mathematical definition for max() I learned in Calculus 101 was
"the smallest element which is > then all arguments" (hence, properly speaking,
max should also specify the set in which it takes place. Doesn't seem to
matter in real life)

>  These functions are supposed
> to return one of their arguments

Why? 
-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez@debian.org  |http://www.{python,debian,gnu}.org