Python Tutorial Was: Guido's regrets: filter and map

David Brown david at no.westcontrol.spam.com
Tue Nov 26 04:43:09 EST 2002


"Courageous" <jkraska at san.rr.com> wrote in message
news:sss5uus0o18jtdi2lcpp3605vfgscmvmum at 4ax.com...
> On 25 Nov 2002 18:56:10 GMT, Grant Edwards <grante at visi.com> wrote:
>
> >In article <arsni0$pnk$1 at news.netpower.no>, David Brown wrote:
> >
> >>> I never liked filter, map and reduce.
> >
> >So don't use them. ;)
>
> Lambda is an abortion, imo. It should be deprecated, and eventually
> removed from the language. It doesn't do what it set out to do
particularly
> well, and suffers from the double sin of being a construct that is
> inherently anti-pythonic. The subset of list comprehensions that can
> be used to do what map/reduce-lambda do are an example of something
> that does what it was intended, is clear, and pythonic.
>
> Just an opinion,
>

Everyone is entitled to their opinion - I happen to like lambda.  I am
comfortable with map(lambda ... ) expressions, but I suppose I should really
use list comprehensions more for that sort of thing.  It depends on whether
I am thinking that I am applying a function to each element in a list, or I
am wanting a new list based on another list with a function applied to each
element.  It amounts to the same thing, but it is viewing it from a
different angle.

But I use lambda functions regularly outside of that.  The alternative is
either far more small functions cluttering the source code and namespace, or
making function-construction functions.  There are definitely some uses for
that sort of thing (lambda has its limitations), but there is no point in
removing a feature that many people find useful just because some people
find it a little odd and out-of-place.






More information about the Python-list mailing list