map/filter/reduce/lambda opinions and background unscientific mini-survey
newsgroups at jhrothjr.com
Sat Jul 2 01:40:39 CEST 2005
"Tom Anderson" <twic at urchin.earth.li> wrote in message
news:Pine.LNX.4.62.0507011430540.12731 at urchin.earth.li...
> During our current discussion of the fate of functional constructs in
> python, someone brought up Guido's bull on the matter:
> He says he's going to dispose of map, filter, reduce and lambda. He's
> going to give us product, any and all, though, which is nice of him.
> What really struck me, though, is the last line of the abstract:
> "I expect tons of disagreement in the feedback, all from ex-Lisp-or-Scheme
> folks. :-)"
> I disagree strongly with Guido's proposals, and i am not an
> ex-Lisp, -Scheme or -any-other-functional-language programmer; my only
> other real language is Java. I wonder if i'm an outlier.
> So, if you're a pythonista who loves map and lambda, and disagrees with
> Guido, what's your background? Functional or not?
As far as biases is concerned: my background is assembler.
I've never learned Lisp (although I did learn Forth at one time.)
I think I could note that originally there were five of the things,
including apply, which was cleanly replaced by the * and **
notation in function definitions and calls.
Map, filter and reduce are three things one can do with lists
(or in fact more general sequences).
List comprehensions cleanly replace filter. They don't
quite replace map, and they definitely don't replace reduce.
Claiming that sum etc. do the same job is the whimper of
someone who doesn't want to openly disagree with Guido.
Lambda is a horse of a quite different color. There are times
when an inline definition is the best thing one can have for
notational expressiveness. While lambda has a lot of
problems, Guido seems to be resisting replacing it with
something that can actually do the job.
Having to define an external function or class doesn't
always improve expressiveness. Sometimes it reduces
it. To quote Sean O'Lochlain: "Sometimes the best
symbol for a sharp knife is a sharp knife." 
 In one of Randall Garrett's Lord Darcy stories.
> Batman always wins
More information about the Python-list