lambda

Daniel Dittmar daniel.dittmar at sap.corp
Thu Jan 13 06:57:36 EST 2005


Egor Bolonev wrote:
> why functions created with lambda forms cannot contain statements?

syntax/technical answer: because lambda is an expression and it is not 
obvious how the syntax for 'statement inside expression' should be

'Python is perfect' answer: if a function contains more than an 
expression, then it's complex enough to require a name

> how to get unnamed function with statements?

You can't. See various threads about Smalltalk/Ruby-like blocks and the 
recent one about the 'where' keyword for proposals to change this

Daniel



More information about the Python-list mailing list