On Wed, Apr 2, 2008 at 9:49 PM, Talin <<a href="mailto:talin@acm.org">talin@acm.org</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Matt Chisholm wrote:<br>
> +1 to handling anonymous functions/lambdas the way JavaScript does.<br>
> It's the only thing I like better about JavaScript than Python.<br>
<br>
</div>Unfortunately, there's no way in Python to have a statement inside of an<br>
expression (because statements are delimited by line ends and<br>
indentation). Many people have attempted this, none have succeeded.<br>
Don't go there, you'll just be opening up old wounds...</blockquote><div><br>Well what's being proposed is for <br><br>def f(x, y): return x*x + y*y<br><br>to be a statement, but for<br><br>def(x,y): x*x + y*y<br>
<br>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.<br>
<br>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.<br><br>- Eli<br><br>
</div></div>