A critic of Guido's blog on Python's lambda
ketil+news at ii.uib.no
Tue May 9 02:44:40 EDT 2006
aleax at mac.com (Alex Martelli) writes:
>> Any time you want an anonymous function (or class, or type, or number)
>> it would be because that thing is sufficiently small and simple that the
>> best name for it is the code itself.
> In the real world, people don't choose anonymous functions only in
> these alleged cases where anonymous is best
In the real world, people do a lot of things they shouldn't.
Any feature can be abused, and poor style is possible in any
language. I just checked my code for lambdas, and they are
exclusively short half-liners passed as parameters to higher order
functions. Naming them would only complicate the code, just like
naming (other) intermediate results would.
> if anonymous functions are available, they're used in even more
> cases where naming would help
Perhps, but not necessarily. But how about the converse: if every
function must be named, they will be named even where naming them
If I haven't seen further, it is by standing in the footprints of giants
More information about the Python-list