I sing the praises of lambda, my friend and savior!

Clark C. Evans cce at clarkevans.com
Wed Oct 13 20:43:33 CEST 2004


On Wed, Oct 13, 2004 at 10:58:14AM -0700, Jeff Shannon wrote:
| Antoon Pardon wrote:
| >I find it better to let the coder decide what makes sense in his program
| >and what not.
| 
| Which is the Perl philosophy.  Many people seem quite happy with Perl 
| because of this TMTOWTDI attitude; personally, I prefer Python's clarity 
| and simplicity.

On this list, that's damn near close to an ad hominem attack.

There are more than one way to do many of things in Python, and just
about every "feature" that gets added is yet another way to do
something that is already being done.   This doesn't stop features
from being adopted, does it?  Every list comprehension has an
equivalent version using a while-loop.  I could go on with examples,
but your assertion is a leaky bucket, so why bother waste the space?
Your arguments thus far have been "I don't use it, thus it probably
isn't useful, and therefore, no one should be able to use it."  It's
an uninformed position and frankly, not very helpful.  

I use lambda because it:

  - puts the definition of an expression right
    where it is used;

  - doesn't require me to mint a name, or worry about
    other possible calls to the same expression; and

  - is efficient use of vertical coding space.

All of these reasons provide clarity in maintaining code.  If you
are working with a programming style that uses CPS, deferred
execution, or similar mechanism with heavy callbacks or passing
functions, you will understand the importance of the above features.

Kind Regards,

Clark



More information about the Python-list mailing list