Securing a future for anonymous functions in Python
annaraven at gmail.com
Fri Jan 7 06:54:50 EST 2005
Okay, I tried to post this previously but ran into the new Google
groups system which appears to have sent my original response into the
ether... Oops. Trying again.
Alan Gauld wrote:
> On Thu, 30 Dec 2004 23:28:46 +1000, Nick Coghlan
> <ncoghlan at iinet.net.au> wrote:
> > GvR has commented that he want to get rid of the lambda keyword for
> > Getting rid of lambda seems like a worthy goal,
> Can I ask what the objection to lambda is?
> 1) Is it the syntax?
> 2) Is it the limitation to a single expression?
> 3) Is it the word itself?
> I can sympathise with 1 and 2 but the 3rd seems strange since a
> lambda is a well defined name for an anonymous function used in
> several programming languages and originating in lambda calculus
> in math. Lambda therefore seems like a pefectly good name to
> So why not retain the name lambda but extend or change the syntax
> to make it more capable rather than invent a wholly new syntax
> for lambdas?
> Slightly confused, but since I only have time to read these
> groups regularly when I'm at home I have probably missed the bulk
> of the discussion over the years.
> Alan G.
> Author of the Learn to Program website
Having taken some calculus (derivatives, limits, some integrals) but
never even heard of lambda calculus, to me, lambda means absolutely
NOTHING. Less than nothing.
Actually, in my encounters with others code in Python (including
reading near 1000 recipes for the recent edition of the Cookbook), what
I've discovered is that what lambda mostly means to me is:
"I don't wanna write clear, elegant Python - I wanna write fancy,
clever, obfuscated code, and lambda lets me do that!"
I've seen maybe 1 case in 10 where lambda appears, to me, to allow
clearer, cleaner code than defining a function. Most cases-it's an
ugly, incomprehensible hack.
So, if people really need anonymous functions in Python (and
apparently, they do), then at least lets get a word that actually
*means* something. Every other word in Python has an obvious meaning.
So, I guess I don't like the word itself - any more than I like how
it's (mostly) used.
Anna Martelli Ravenscroft
More information about the Python-list