max(), sum(), next()

castironpi castironpi at gmail.com
Thu Sep 4 16:25:05 EDT 2008


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.  The reason
sum([]) is 0 is that sum( [ x ] ) - x = 0.



More information about the Python-list mailing list