This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author achampion
Recipients achampion
Date 2015-09-20.08:46:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442738800.12.0.18115193144.issue25193@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-09-20 08:46:40achampionsetrecipients: + achampion
2015-09-20 08:46:40achampionsetmessageid: <1442738800.12.0.18115193144.issue25193@psf.upfronthosting.co.za>
2015-09-20 08:46:40achampionlinkissue25193 messages
2015-09-20 08:46:39achampioncreate