[issue7176] sum() doesn't work for lists.
report at bugs.python.org
Mon Oct 26 21:57:07 CET 2009
Björn Augustsson <oggust at gmail.com> added the comment:
On Tue, Oct 20, 2009 at 20:19, Raymond Hettinger <report at bugs.python.org> wrote:
> Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:
> One use of the start argument is used to specify an initial zero/metpy
> value for the summation: 0 or 0.0 or Decimal(0) or .
That means it's basically a way for you to tell sum() what the type of the
first argument is. Which it could find out for itself.
> BTW, sum() isn't a good technique for concatenating lists. Instead use
> something like:
> result = 
> for seq in data:
> A fast one-liner version:
> result = list(itertools.chain.from_iterable(seq))
IMHO there's no reason for sum() not to be as fast as possible at doing
what it does. ("summing"). If it's somehow slower than the (way less readable)
itertools incantation above, then I'd consider that to be a bug.
Wrong on most accounts. const Foo *foo; and Foo const *foo; mean the same: foo
being a pointer to const Foo. const Foo const *foo; would mean the same but is
illegal (double const). You are confusing this with Foo * const foo; and const
Foo * const foo; respectively. -David Kastrup, comp.os.linux.development.system
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list