Message251155
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. |
|
Date |
User |
Action |
Args |
2015-09-20 08:46:40 | achampion | set | recipients:
+ achampion |
2015-09-20 08:46:40 | achampion | set | messageid: <1442738800.12.0.18115193144.issue25193@psf.upfronthosting.co.za> |
2015-09-20 08:46:40 | achampion | link | issue25193 messages |
2015-09-20 08:46:39 | achampion | create | |
|