Re: [Python-Dev] [Python-checkins] cpython: Add optional *func* argument to itertools.accumulate().

2011-03-28 Thread Daniel Stutzbach
On Sun, Mar 27, 2011 at 10:53 PM, Nick Coghlan ncogh...@gmail.com wrote: On Mon, Mar 28, 2011 at 2:11 PM, Daniel Stutzbach stutzb...@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,

Re: [Python-Dev] [Python-checkins] cpython: Add optional *func* argument to itertools.accumulate().

2011-03-28 Thread Raymond Hettinger
On Mar 28, 2011, at 12:38 AM, Daniel Stutzbach wrote: On Sun, Mar 27, 2011 at 10:53 PM, Nick Coghlan ncogh...@gmail.com wrote: On Mon, Mar 28, 2011 at 2:11 PM, Daniel Stutzbach stutzb...@google.com wrote: Is there a good use-case for the func argument? The examples that Raymond gives

Re: [Python-Dev] [Python-checkins] cpython: Add optional *func* argument to itertools.accumulate().

2011-03-28 Thread Georg Brandl
On 28.03.2011 09:49, Raymond Hettinger wrote: On Mar 28, 2011, at 12:38 AM, Daniel Stutzbach wrote: On Sun, Mar 27, 2011 at 10:53 PM, Nick Coghlan ncogh...@gmail.com mailto:ncogh...@gmail.com wrote: On Mon, Mar 28, 2011 at 2:11 PM, Daniel Stutzbach stutzb...@google.com

Re: [Python-Dev] [Python-checkins] cpython: Add optional *func* argument to itertools.accumulate().

2011-03-28 Thread Daniel Stutzbach
On Mon, Mar 28, 2011 at 12:49 AM, Raymond Hettinger raymond.hettin...@gmail.com wrote: Do a google code search for R's builtin functions cumsum, cumprod, cummin, and cummax. Look at mumpy's accumulate ufunc which works with many operators. APL and K also have an accumulate tool which takes

Re: [Python-Dev] [Python-checkins] cpython: Add optional *func* argument to itertools.accumulate().

2011-03-27 Thread Daniel Stutzbach
On Sun, Mar 27, 2011 at 6:52 PM, raymond.hettinger python-check...@python.org wrote: -.. function:: accumulate(iterable) +.. function:: accumulate(iterable[, func]) Make an iterator that returns accumulated sums. Elements may be any addable -type including :class:`Decimal` or

Re: [Python-Dev] [Python-checkins] cpython: Add optional *func* argument to itertools.accumulate().

2011-03-27 Thread Nick Coghlan
On Mon, Mar 28, 2011 at 2:11 PM, Daniel Stutzbach stutzb...@google.com wrote: Is there a good use-case for the func argument?  I can only think of bad use-cases (where func does something that does not remotely resemble addition).  I fear that people will actually implement these bad use-cases,