sum for sequences?

Paul Rubin at nospam.invalid
Sun Mar 28 22:49:32 CEST 2010

Steve Howell <showell30 at> writes:
> The documentation is pretty clear on the intention that sum() is
> intended for numbers: ...

I've never been big on the idea of duck-typing addition.  Who would have
thought that (1,2,3)+(4.5.6) was something other than the vector sum?

I think itertools.chain more directly expresses what the OP was trying
to do, and is preferable for readability, independently of these
performance questions.

More information about the Python-list mailing list