A critic of Guido's blog on Python's lambda

Ketil Malde ketil+news at ii.uib.no
Wed May 10 10:36:03 CEST 2006


aleax at mac.com (Alex Martelli) writes:

> But if we can agree to name every function except continuations I'll be
> content

FWIW, I disagree:

A simple example, doubling each entry in a list:

    map (*2) xs     
vs. let double x = x*2 in map double xs

Here's another example, extracting all lines that contain at least one
word:

    filter (not.null) . map words . lines

Note that I'm using the following anonymous functions:

     not . null 
     filter (not . null)
     map words
     filter (not.null) . map words

Would it really improve anything if I named these?  It seems
incredibly pedestrian, along the lines of requiring a comments for
every source line:

      x++;         /* increase x by one */
      a[x] = ' ';  /* insert a space in a at position x */

Sometimes the best documentation is the code itself.  Sometimes the
best name for a function is the code itself.

-k     
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Python-list mailing list