<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 10 October 2014 20:42, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Fri, Oct 10, 2014 at 8:06 AM, Adam Jorgensen <span dir="ltr"><<a href="mailto:adam.jorgensen.za@gmail.com" target="_blank">adam.jorgensen.za@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div dir="ltr">So, as I understand it, the main reason we don't have multi-line anonymous functions is because there has been no consensus about <div>the syntax.</div></div></blockquote><div><br></div></span><div>Well, it's worse -- it's hard to propose a syntax that actually works without huge changes to the way Python's parser treats indentation: inside parentheses, indentation is currently *not* significant.<br></div></div></div></div></blockquote><div><br></div><div>Aaaaaah, this was exactly the area I figured would be an issue when I thought about the problem for more than 10 seconds :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I was just wondering if someone has a document detailing the various syntaxes that have been proposed in the the past.</div></div></blockquote><div><br></div></span><div>No, but there have been many discussions. If you have a taste for mailing list archaeology it would be nice of you could dig up the various threads and summarize them for posterity, so at least we might make progress rather than going around in circles.<br><br></div><div>As for myself, I have encountered a number of languages that do support multi-line anonymous functions (Java, JavaScript, CoffeeScript) and I have to say that for some reason they do not lead to very readable code. Especially in the latter two, the prevalent use for anonymous functions is for asynchronous I/O callbacks. I find Python 3.4's "yield from" as used by the asyncio library leads to much more readable code, without he need for callback functions at all.</div></div></div></div></blockquote><div><br></div><div>I agree that anonymous functions do have the potential to produce illegible code, although I think this might be more a product of those languages general ability to enable said illegibility :-)</div><div><br></div><div>In the context of python the only strong use-case I personally have for anonymous functions is a (extant) scenario where I'm writing nested decorators that don't use the decorator package to preserve signatures (There are some instances where signature preservation is actually undesirable :-). In this scenario the nested defs *might* be cleaner written in using anonymous functions, although there's no guarantee and it's not exactly a common scenario anyway...</div><div><br></div><div>Maybe if I have some time I'll do the archaeology and cobble together a summary of the various proposals...</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><span><font color="#888888"><br></font></span></div></div><span><font color="#888888">-- <br>--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)
</font></span></div></div>
</blockquote></div><br></div></div>