max(), sum(), next()

Wojtek Walczak gminick at bzt.bzt
Thu Sep 4 14:09:14 EDT 2008


On Thu, 4 Sep 2008 10:57:35 -0700 (PDT), Mensanator wrote:

> Why then, doesn't
>
>>>> sum([A for A in [None, None, None, None, None, None] if A != None])
> 0
>
> give me an error?

Because "[A for A in [None, None, None, None, None, None] if A != None]"
returns an empty list, and sum([]) doesn't return an error. What did you
expect?


-- 
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/



More information about the Python-list mailing list