[Python-ideas] Lambda again: Anonymous function definition
Joel Bender
jjb5 at cornell.edu
Thu Mar 27 14:29:37 CET 2008
Greg wrote:
> What's needed is something very concise and unobtrusive,
> such as
>
> x, y => x + y
As inspired by Prolog:
x, y :- x + y
So this:
f = lambda x, y: x ** 2 + y ** 2
Or this:
def f(x, y): return x ** 2 + y ** 2
Becomes this:
f = x, y :- x ** 2 + y ** 2
And would logically transpose into this:
f(x, y) :- x ** 2 + y ** 2
Oooo...this rabbit hole is fun!
Joel
More information about the Python-ideas
mailing list