How about something like:

f = indef(x, y): print x, y

It's essentially storing lambdas. The syntax was taken from http://blog.deliciousrobots.com/2010/3/24/a-simple-compiler-with-python-and-ply-step-1-parsing/. indef stands for 'inline definition'. I've never heard someone use that name before. Or you could do 'slambda' for 'stored lambda'.

Musical Notation <musicdenotation@gmail.com> wrote:
Yes, I know that multiline lambda will never be implemented in Python, but in many languages it is possible to write an anonymous function without using lambda at all.
In JavaScript:
Instead of "function <name>(<variables>){code}" you can write "var name; name=function(<variables>){code}"
Python (proposed):
def func(a,b):
    print(a+b)
    return a+b

becomes

func=function a,b:
    print(a+b)
    return a+b



Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.