A critic of Guido's blog on Python's lambda
Tomasz Zielonka
tomasz.zielonka at gmail.com
Mon May 8 01:11:06 EDT 2006
Alex Martelli wrote:
> Worst case, you name all your functions Beverly so you don't have to
> think about the naming
I didn't think about this, probably because I am accustomed to Haskell,
where you rather give functions different names (at the module top-level
you have no other choice). I just checked that it would work for nested
Beverly-lambdas (but could be quite confusing), but how about using more
then one lambda in an expression? You would have to name them
differently.
> but you also have a chance to use meaningful names (such as,
> presumably, zipperize_widget is supposed to be here) to help the
> reader.
[OK, I am aware that you are talking solely about lambdas in Python,
but I want to talk about lambdas in general.]
Sometimes body of the function is its best description and naming what
it does would be only a burden. Consider that the same things that you
place in a loop body in python, you pass as a function to a HOF in
Haskell. Would you propose that all loops in Python have the form:
def do_something_with_x(x):
...
do something with x
for x in generator:
do_something_with_x(x)
Also, having anonymous functions doesn't take your common sense away, so
you still "have a chance".
Best regards
Tomasz
More information about the Python-list
mailing list