[issue25193] itertools.accumulate should have an optional initializer argument

2015-11-02 Thread Alun Champion
Alun Champion added the comment: Understandable, though it would have also made the first order recurrence relationships more accurate, e.g. annualized interest on an initial balance: accumulate(repeat(None), lambda: bal, _: bal*1.05, initializer=1000) vs. artificially repeating 1000:

[issue25193] itertools.accumulate should have an optional initializer argument

2015-10-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: To me prime sieve demos and puzzle problems aren't motivating use cases. Also, the two examples in the single stack-exchange answer become awkward because they would also need a middle argument for the accumulation function: Current: cs = accumulate(chai

[issue25193] itertools.accumulate should have an optional initializer argument

2015-10-25 Thread Alun Champion
Alun Champion added the comment: If you are looking for other examples. Here's a wheel factorization of an indefinite sieve (primes) that was peer reviewed on codereview.stackexchange.com, see the final result in the last post by Will Ness: http://codereview.stackexchange.com/questions/92365/w

[issue25193] itertools.accumulate should have an optional initializer argument

2015-10-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: > OTOH, none of those projects is natural fit for itertools, > so changing itertools wouldn't help them directly. Indeed, this may not be a natural fit for itertools problems. As a side note, the itertools were designed to form the elements of "an iterator

[issue25193] itertools.accumulate should have an optional initializer argument

2015-09-21 Thread Mark Dickinson
Mark Dickinson added the comment: A couple of observations: 1. Haskell's (rough) equivalents would be `mapAccumL` and `mapAccumR`, which do take an initializer [1]. The signature for both functions is something like: (acc -> b -> (acc, c)) -> acc -> [b] -> (acc, [c]). 2. In the particular ca

[issue25193] itertools.accumulate should have an optional initializer argument

2015-09-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- title: itertools.accumlate should have an optional initializer argument -> itertools.accumulate should have an optional initializer argument ___ Python tracker