sum for sequences?

Patrick Maupin pmaupin at
Tue Apr 6 10:31:38 EDT 2010

On Apr 6, 8:39 am, Albert van der Horst <alb... at>

> To a mathematician sum(set) suggest that the order of summation
> doesn't matter. (So I wouldn't use sum for concatenating lists.)
> Harshly, sum() should be used only for operator + both associative and
> commutative.

That's all well and good, but not every Python user is a
mathematician.  As long as Python doesn't surprise mathematicians in a
way that is too negative (I can see the complaint now: "Hey!  sum()
kept my lists ordered!  I was expecting some randomization!") what is
wrong with it also not surprising the average user in a way that is
too negative?


More information about the Python-list mailing list