[Python-ideas] Syntax for passing lambdas to functions

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 27 08:14:08 CET 2014


Steven D'Aprano wrote:
> It's really a bad idea to have syntax for a "shorter lambda" 
> that works here:
> 
>     f(arg=***whatever***)
> 
> but not in these:
> 
>     f(***whatever***)
>     [len, zip, map, ***whatever***, some_function]
>     result = ***whatever***(arg)

The last one could be made to work as well, then it would be
less of a special case. It would be a specialised form of
assignment that's optimised for binding a name to a function,
similar to def except that the body is an expression rather
than a statement.

-- 
Greg


More information about the Python-ideas mailing list