max(), sum(), next()

Boris Borcic bborcic at gmail.com
Tue Sep 9 15:47:20 CEST 2008


castironpi wrote:
> On Sep 8, 8:54 am, Boris Borcic <bbor... at gmail.com> wrote:
>> David C. Ullrich wrote:
>>
>>> (ii) If A is a subset of B then we should have
>>> max(A) <= max(B). This requires that max(empty set)
>>> be something that's smaller than everything else.
>>> So we give up on that.
>> Er, what about instances of variations/elaborations on
>>
>> class Smaller(object) : __cmp__ = lambda *_ : -1
>>
>> ?
>>
>> Cheers, BB
> 
> You still don't have the property max(X) is in X.

Frankly, I would favor order-independence over that property.

compare max(X) for

1) X = [set([1]),set([2])]

and

2) X = [set([2]),set([1])]

Shouldn't then max and min in fact return lub and glb, despite their names ? In 
the case X is a non-empty finite set/list of totally ordered values, 
max(X)==lub(X) and min(X)=glb(X) in any case.

> 
> And it's the equivalent of a special builtin constant for max on the
> empty set.

Of course (except the object might have other uses, who knows). So what ?

Cheers, BB




More information about the Python-list mailing list