max(), sum(), next()

Manu Hack manuhack at gmail.com
Sat Sep 6 04:20:06 CEST 2008


On Fri, Sep 5, 2008 at 1:04 PM, castironpi <castironpi at gmail.com> wrote:
> On Sep 5, 3:28 am, "Manu Hack" <manuh... at gmail.com> wrote:
>> On Thu, Sep 4, 2008 at 4:25 PM, castironpi <castiro... at gmail.com> wrote:
>> > On Sep 4, 2:42 pm, bearophileH... at lycos.com wrote:
>> >> David C. Ullrich:
>>
>> >> > At least in mathematics, the sum of the elements of
>> >> > the empty set _is_ 0, while the maximum element of the
>> >> > empty set is undefined.
>>
>> >> What do you think about my idea of adding that 'default' argument to
>> >> the max()/min() functions?
>>
>> >> Bye,
>> >> bearophile
>>
>> > For max and min, why can't you just add your argument to the set
>> > itself?
>>
>> > The reason max([]) is undefined is that max( S ) is in S.
>>
>> It makes sense.
>>
>> >The reason sum([]) is 0 is that sum( [ x ] ) - x = 0.
>>
>> It doesn't make sense to me.  What do you set x to?
>
> For all x.

But then how can you conclude sum([]) = 0 from there?  It's way far
from obvious.



More information about the Python-list mailing list