Accumulate function in python

Stefan Behnel stefan_ml at behnel.de
Tue Jul 27 07:16:59 EDT 2010


geremy condra, 27.07.2010 12:54:
> On Wed, Jul 21, 2010 at 8:17 AM, John Nagle wrote:
>> On 7/19/2010 9:56 AM, dhruvbird wrote:
>>>
>>> On Jul 19, 9:12 pm, Brian Victor  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.
>
> Too bad about the lack of concurrency, would be many places where that
> would be nice.

Besides the many places where the current properties match just fine, there 
are some places where concurrency would be helpful. So I wouldn't call it 
"lack" of concurrency, as that seems to imply that it's a missing feature 
in what both builtins are targeted to provide. Just use one of the 
map-reduce frameworks that are out there if you need concurrency in one way 
or another. Special needs are not what builtins are there for.

Stefan




More information about the Python-list mailing list