Multi-line lambda proposal.

Leif K-Brooks eurleif at ecritters.biz
Mon May 8 21:10:39 EDT 2006


Kaz Kylheku wrote:
> But suppose that the expression and the multi-line lambda body are
> reordered? That is to say, the expression is written normally, and the
> mlambda expressions in it serve as /markers/ indicating that body
> material follows. This results in the most Python-like solution.

I think your proposal is good, but it might be more easily understood if 
we gave names to the lambdas, so that they could be easily picked out in 
the source code. It could look something like this:

func(lambda foo):
     foo:
         print "Foo!"

Come to think of it, maybe we could put the lambdas before the statement 
they're used in instead of in front of it. That could look something 
like this:

lambda foo:
     print "Foo!"
func(lambda foo)

Then again, it would probably be simpler to reuse an existing 
block-starting keyword for the purpose. Maybe something like this?

def foo():
     print "Foo!"
func(foo)



More information about the Python-list mailing list