Securing a future for anonymous functions in Python

Anna annaraven at gmail.com
Sun Jan 9 11:49:51 EST 2005


Jacek Generowicz wrote:
> "Anna" <annaraven at gmail.com> writes:
>
> > Having taken some calculus (derivatives, limits, some integrals)
but
> > never even heard of lambda calculus, to me, lambda means absolutely
> > NOTHING. Less than nothing.
>
> And before you took calculus, the chances are that derivatives,
limits
> and integrals meant less than nothing to you.
>
> But now, I am quite sure, you know that in Python lambda is a keyword
> which creates anonymous functions. Now that you know what lambda
does,
> what's the problem with it? (It certainly doesn't mean "Less than
> nothing" to you now.)
>
> > So, I guess I don't like the word itself
>
> Fair enough. I guess there are people out there who might have a
> distaste for the word "class" or "def" or any of the other words
which
> are keywords in Python.
>
> > Every other word in Python has an obvious meaning.  lambda doesn't.
>
> Obvious to whom?
>
> The meaning of every word is obvious, once you have been taught it;
> and a complete mystery if you have not.
>
> What do you make of "seq[2:-2]"? It means "less than nothing" to the
> uninitiated. Just like lambda.

Actually - whether or not I understood the [2:-2] notation, knowing
nothing else,  the "seq" would clue me in that we're probably doing
something with sequences...

Personally, I like lambdas less than regular expressions (of which I'm
particularly UNfond but understand their usefulness at times). At least
with regular expressions - I know that the gibberish I need to decipher
(probably) has to do with text parsing... With class and def, I at
least have a *name* to start with - class Square pretty obviously is
going to have something to do with geometric shapes, I would hope (or
maybe with boring people...). def getfoo() tells me I'm the function is
likely to go elsewhere and get something. It's a *start*, a handle, to
deciphering whatever the following statements are doing. (Yes, I
realize that often class and function names suck - but more often than
not, they give *some* clue).

Whereas, with lambda - I have *nothing* to go on.  With lambdas, all I
know is that the programmer wanted to hide whatever it is the program
is doing behind the curtain... (at least that's the way it comes
across). So, not only is the word itself not descriptive of anything to
me - even knowing that it means "anonymous function" - the use of it
precludes descriptiveness, as compared to defining a function. IMHO,
YMMV, etc etc

Anna




More information about the Python-list mailing list