Accumulate function in python

John Nagle nagle at animats.com
Wed Jul 21 11:17:36 EDT 2010


On 7/19/2010 9:56 AM, dhruvbird wrote:
> On Jul 19, 9:12 pm, Brian Victor<homeusen... at brianhv.org>  wrote:
>> dhruvbird wrote:

>> Having offered this, I don't recall ever seeing reduce used in real
>> python code, and explicit iteration is almost always preferred.
>
> Yes, even I have noticed that reduce is a tad under-used function.

     Yes, I had a use case for it once, but it wasn't worth the trouble.
"map" is often useful, but "reduce", not so much.

     Python isn't really a functional language.  There's no bias toward
functional solutions, lambdas aren't very general, and the performance
isn't any better.  Nor is any concurrency provided by "map" or "reduce".
So there's no win in trying to develop cute one-liners.

					John Nagle



More information about the Python-list mailing list