sum(strings)
Greg Ewing (using news.cis.dfn.de)
g2h5dqi002 at sneakemail.com
Thu Jun 19 23:26:41 EDT 2003
Raymond Hettinger wrote:
> Because there is just one right way to do it:
>
> "".join([str1, str2, str3, ...])
Hmmm... maybe this ought to be the "right"
way to do summing as well:
total = 0.join([17, 42, 88])
Reductions using operators other than "+"
would be obtained by choosing the appropriate
identity element for the operation, e.g.
1.join([17, 42, 88])
would give you their product, etc.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list