Björn Augustsson <ogg...@gmail.com> added the comment: On Tue, Oct 20, 2009 at 20:19, Raymond Hettinger <rep...@bugs.python.org> wrote: > > Raymond Hettinger <rhettin...@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: > result.extend(seq) > > 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. /August. -- 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 <rep...@bugs.python.org> <http://bugs.python.org/issue7176> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com