max(), sum(), next()
kyrie at uh.cu
Sun Sep 7 16:38:06 EDT 2008
Quoting Mensanator <mensanator at aol.com>:
> Actualy, I already get the behaviour I want. sum([1,None])
> throws an exception. I don't see why sum() doesn't throw
> an exception also
If you take a "start value" and add to it every element of a list, should the
process fail if the list is empty? If you don't add anything to the start value,
you should get back the start value.
Python's sum is defined as sum(sequence, start=0). If sum were to throw an
exception with sum(), it should also throw it with sum(, start=0), wich
makes no sense.
Facultad de Matemática y Computación, UH
More information about the Python-list