best cumulative sum

David Isaac aisaac0 at verizon.net
Wed Nov 23 16:20:24 CET 2005


> Michael Spencer wrote:
> > This can be written more concisely as a generator:


<bonono at gmail.com> wrote in message
news:1132708265.941224.186550 at g44g2000cwa.googlegroups.com...
> If iterable has no elements, I believe the behaviour should be [init],
> there is also the case of init=None that needs to be handled.

Right.  So it is "more concise" only by being incomplete, right?
What other advantages might it have?

> otherwise, that is more or less what I wrote for my scanl/scanl1.

I didn't see a post with that code.

Alan Isaac





More information about the Python-list mailing list