max(), sum(), next()
bborcic at gmail.com
Tue Sep 9 15:47:20 CEST 2008
> 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(),set()]
2) X = [set(),set()]
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 ?
More information about the Python-list