[Python-ideas] Lambda again: Anonymous function definition
eli at courtwright.org
Thu Apr 3 15:57:31 CEST 2008
On Wed, Apr 2, 2008 at 9:49 PM, Talin <talin at acm.org> wrote:
> Matt Chisholm wrote:
> Unfortunately, there's no way in Python to have a statement inside of an
> expression (because statements are delimited by line ends and
> indentation). Many people have attempted this, none have succeeded.
> Don't go there, you'll just be opening up old wounds...
Well what's being proposed is for
def f(x, y): return x*x + y*y
to be a statement, but for
def(x,y): x*x + y*y
to be an expression. In other words, anonymous def will behave exactly like
lambda does now. This seems doable, though I don't know Python's parsing
code well enough to understand how difficult it would be to implement.
Of course, we all understand that lambda won't change anytime soon; this is
really more of a hypothetical "what if we did this in 10 years if there's
ever a Python 4000" discussion.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas