[Python-3000] map, filter, reduce

Georg Brandl g.brandl at gmx.net
Sat Jun 2 09:24:02 CEST 2007


Greg Ewing schrieb:
> Terry Reedy wrote:
>> It would generate the sequence of partial reductions (potentially 
>> indefinately).
>> list(ireduce(summer, 0, range(5)) = [0, 1, 3, 6, 10]
>> 
>> This is obviously *not* the same as a reduce() which only returns the final 
>> value without the intermediate values.
> 
> It's sufficiently different that I think calling it
> 'ireduce' would just be confusing.
> 
> It's more like a 'running_reduce' or something.

ISTM that this application is even more suited for a plain old `for` loop.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-3000 mailing list