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

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat, 24 Mar 2001 17:49:10 +0100


> On Sat, 24 Mar 2001, Martin v. Loewis wrote:
> > So given a subset of a lattice, it may not have a maximum, but it will
> > always have a supremum. It appears that the Python max function
> > differs from the mathematical maximum in that respect: max will return
> > a value, even if that is not the "largest value"; the mathematical
> > maximum might give no value.
> 
> Ah, but in Python most collections are usually finite. :)

Even  a  finite collection  may  not  have  a maximum,  which  Moshe's
original example illustrates:

s1 = set(1,4,5)
s2 = set(4,5,6)

max([s1,s2]) == ???

With respect to the subset relation, the collection [s1,s2] has no
maximum; its supremum is set(1,4,5,6). A maximum is only guaranteed to
exist for a finite collection if the order is total.

Regards,
Martin