map/filter/reduce/lambda opinions and background unscientificmini-survey

Carl Banks invalidemail at aerojockey.com
Sun Jul 3 11:57:24 CEST 2005


John Roth wrote:
> "Robert Kern" <rkern at ucsd.edu> wrote in message
> news:mailman.1226.1120271406.10512.python-list at python.org...
>
> >
> > map and filter are being removed *because of* list comprehensions. Did you
> > even read Guido's articles about this issue? Your understanding of why
> > these changes are planned is incorrect; consequently your projection based
> > on that understanding is not on firm footing.
>
> May I most respectfully point out that you've got it backwards.
> Part of the justification for list comprehensions was that they could
> be used to replace map and filter.
>
> The jihad against the functional constructs has been going on for a
> long time, and list comprehensions are only one piece of it.


Many people believe that the functional constructs in Python exist to
enhance Python's support of functional programming, but that's wrong.
They exist to enhance support of procedural programming.

In other words, the functional elements were added not because Python
embraced functional programming, but because discreet use of functional
code can make procedural programs simpler and more concise.

Listcomps et al. cannot do everything map, lambda, filter, and reduce
did.  Listcomps are inferior for functional programming.  But, you see,
functional is not the point.  Streamlining procedural programs is the
point, and I'd say listcomps do that far better, and without all the
baroque syntax (from the procedural point of view).

Jihad?  I'd say it's mostly just indifference to the functional
programming cause.


-- 
CARL BANKS




More information about the Python-list mailing list