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 mark.dickinson
Recipients achampion, mark.dickinson, rhettinger
Date 2015-09-21.12:09:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442837347.6.0.593968404253.issue25193@psf.upfronthosting.co.za>
In-reply-to
Content
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 case of NumPy, I've found np.cumsum a pain to use on multiple occasions because of the missing left-hand point in the result.  Grepping through a couple of recent (real-world) projects produces code like:

    summed_widths = cumsum(hstack(([0], widths[:-1])))

and

    cumulative_segments = np.insert(np.cumsum(segment_lengths), 0, 0.0)

where that extra missing value is having to be inserted either in the input list or the output list. OTOH, none of those projects is natural fit for itertools, so changing itertools wouldn't help them directly.

[1] https://www.haskell.org/hoogle/?hoogle=mapAccumL
History
Date User Action Args
2015-09-21 12:09:07mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, achampion
2015-09-21 12:09:07mark.dickinsonsetmessageid: <1442837347.6.0.593968404253.issue25193@psf.upfronthosting.co.za>
2015-09-21 12:09:07mark.dickinsonlinkissue25193 messages
2015-09-21 12:09:07mark.dickinsoncreate