[Python-Dev] Lambda & deferred evaluation (was: Adding any() and all())

Nick Coghlan ncoghlan at iinet.net.au
Sat Mar 12 01:55:25 CET 2005


Barry Warsaw wrote:
> On Fri, 2005-03-11 at 12:18, Raymond Hettinger wrote:
>>Lambda will be more difficult.  Eric Raymond adapted an anti-gun control
>>slogan and said "you can pry lambda out of my cold dead hands."  A bunch
>>of folks will sorely miss the ability to create anonymous functions on
>>the fly.  When lambda is used for deferred argument evaluation (a la PEP
>>312), the def syntax is a crummy substitute.
> 
> 
> Yeah, I'm with you here.  As warty as lambda is, it just is so damn
> convenient some times.  I've recently been using it as a companion to
> property(), providing concise definitions of read-only attributes.

I'm hoping that "lambda goes in Python3K" will get rid of the *existing* lambda, 
so that a more Pythonic syntax for deferred evaluation can be found. At the 
moment, any such attempt to come up with an alternate syntax tends to get 
shouted down on the basis that "you can already use lambda, TOOWTDI, stop 
wasting time".

I see the *feature* as useful, but the current syntax as lousy. If it was a PEP, 
the latter would be grounds for rejection of lambda expressions (such as 
happened to PEP 308).

A collection of alternate suggestions did get posted to the Wiki though (my 
personal favourite is "(<expr> from <args>)"): 
http://www.python.org/moin/AlternateLambdaSyntax

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net


More information about the Python-Dev mailing list