[Python-Dev] [Python-checkins] cpython: Add optional *func* argument to itertools.accumulate().
Daniel Stutzbach
stutzbach at google.com
Mon Mar 28 09:38:08 CEST 2011
On Sun, Mar 27, 2011 at 10:53 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Mon, Mar 28, 2011 at 2:11 PM, Daniel Stutzbach <stutzbach at google.com>
> wrote:
> > Is there a good use-case for the func argument?
>
> The examples that Raymond gives in the docs (cumulative
> multiplication, running min/max, cash flow accumulation) look fairly
> solid to me.
(I had the nagging suspicion that I was making a blunder in my email, but I
couldn't see it despite rereading my email several times before sending. My
blunder was in not rereading the patch to see the examples. Anyway...)
When would a running product, min, or max be useful?
for running_min in accumulate(data, min):
# Do what?
--
Daniel Stutzbach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110328/97bea9fc/attachment.html>
More information about the Python-Dev
mailing list