sum for sequences?
Patrick Maupin
pmaupin at gmail.com
Tue Apr 6 10:31:38 EDT 2010
On Apr 6, 8:39 am, Albert van der Horst <alb... at spenarnc.xs4all.nl>
wrote:
> 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?
Regards,
Pat
More information about the Python-list
mailing list