This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author oggust
Recipients mark.dickinson, oggust, rhettinger
Date 2009-10-26.20:57:05
SpamBayes Score 3.4533912e-06
Marked as misclassified No
Message-id <7d4a02d80910261357k231f4569r5b95c16df18043a1@mail.gmail.com>
In-reply-to <1256066361.67.0.856908036986.issue7176@psf.upfronthosting.co.za>
Content
On Tue, Oct 20, 2009 at 20:19, Raymond Hettinger <report@bugs.python.org> wrote:
>
> Raymond Hettinger <rhettinger@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
History
Date User Action Args
2009-10-26 20:57:07oggustsetrecipients: + oggust, rhettinger, mark.dickinson
2009-10-26 20:57:05oggustlinkissue7176 messages
2009-10-26 20:57:05oggustcreate