[Python-ideas] Syntax for passing lambdas to functions

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Feb 26 01:17:01 CET 2014


I was reading a blog post here:

http://stupidpythonideas.blogspot.co.nz/2014/02/fixing-lambda.html

where the author points out that there are a number
of different problems that the various enhanced-lambda
proposals are trying to solve, which are best addressed
by different solutions.

Here's a suggestion for one of them. Suppose we could
write things like:

    sorted(things, key(x) = x.date)

    Button("Do it!", on_click() = fire_the_ducks())

It only addresses the case of passing a function using
a keyword argument, but I think it would make for very
readable code in those cases. And it doesn't use any
colons!

-- 
Greg



More information about the Python-ideas mailing list