New submission from Alun Champion:

itertools.accumulate should have an initializer with the same semantics as 
functools.reduce.
These two functions are closely related, reduce only providing you the end 
result accumulate providing an iterator over all the intermediate results.
However, if you want all the intermediate results to this reduce:

    functools.reduce(operator.mul, range(1, 4), 10)

You currently need to do:

    itertools.accumulate(itertools.chain([10], range(1,4), operator.mul)

Adding an optional initialiser argument would avoid this.

----------
components: Library (Lib)
messages: 251155
nosy: Alun Champion
priority: normal
severity: normal
status: open
title: itertools.accumlate should have an optional initializer argument
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25193>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to