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

Alex Martelli aleaxit at yahoo.com
Sun May 7 02:05:59 EDT 2006


Tomasz Zielonka <tomasz.zielonka at gmail.com> wrote:
   ...
> higher level languages. There are useful programming techniques, like
> monadic programming, that are infeasible without anonymous functions.
> Anonymous functions really add some power to the language.

Can you give me one example that would be feasible with anonymous
functions, but is made infeasible by the need to give names to
functions?  In Python, specifically, extended with whatever fake syntax
you favour for producing unnamed functions?

I cannot conceive of one.  Wherever within a statement I could write the
expression
    lambda <args>: body
I can *ALWAYS* obtain the identical effect by picking an otherwise
locally unused identifier X, writing the statement
    def X(<args>): body
and using, as the expression, identifier X instead of the lambda.

 
> On the other hand, what do you get by allowing ( as an indentifier?

Nothing useful -- the parallel is exact.


> Significant whitespace is a good thing, but the way it is designed in
> Python it has some costs. Can't you simply acknowledge that?

I would have no problem "acknowledging" problems if I agreed that any
exist, but I do not agree that any exist.  Please put your coding where
your mouth is, and show me ONE example that would be feasible in a
Python enriched by unlimited unnamed functions but is not feasible just
because Python requires naming such "unlimited" functions.


Alex



More information about the Python-list mailing list