map/filter/reduce/lambda opinions and background unscientific mini-survey

Robert Kern rkern at ucsd.edu
Mon Jul 4 06:33:05 CEST 2005


Erik Max Francis wrote:
> Ron Adam wrote:
> 
>>So you are saying that anything that has a 1% use case should be 
>>included as a builtin function?
>>
>>I think I can find a few hundred other functions in the library that are 
>>used more than ten times as often as reduce.  Should those be builtins too?
>>
>>This is a practical over purity issue, so what are the practical reasons 
>>for keeping it.  "It's already there" isn't a practical reason.  And it 
>>covers 100% of it's own potential use cases, is circular logic without a 
>>real underlying basis.
> 
> But the Python 3000 plan, at least what we've heard of it so far, isn't 
> to move it to a standard library module.  It's to remove it altogether, 
> replacing it with sum and product.  Since sum and product don't cover 
> all the uses cases for reduce, this is a case of taking one function 
> that handles all the required use cases and replacing it with _two_ 
> functions that don't.  Since it's doubling the footprint of the reduce 
> functionality, arguments about avoiding pollution are red herrings.

Four, in fact. sum(), product(), any(), and all().

The problem with this discussion is that no one is saying anything 
new[1]. We've heard all of the arguments for and against removing these 
functions. Over and over and over again. They're not changing anyone's 
mind, not yours, not mine, and definitely not Guido's.

And it's not even like Python 3000 is around the corner or in any stage 
of concrete planning. Adding our voices to the chorus *now* won't make a 
bit of difference, nor should it. The size of the chorus doesn't matter; 
Python isn't developed by votes. We tried that once before; it didn't 
work so well.

When planning for Python 3000 really gets going, when Guido gets a 
year's sabbatical to work on it, when we can see how 
map/filter/reduce/lambda fit into the whole scheme of how this new 
language works, *then* is the time to be having these discussions. Right 
now, all we're doing is making each other bitter and angry for no good 
reason.

[1] Okay, there was that guy who predicted that list comprehensions and 
first-class functions were the next to go. That was new. But also wrong. 
I think we can discount that.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list