On 10 October 2014 20:42, Guido van Rossum <guido@python.org> wrote:
On Fri, Oct 10, 2014 at 8:06 AM, Adam Jorgensen <adam.jorgensen.za@gmail.com> wrote:

So, as I understand it, the main reason we don't have multi-line anonymous functions is because there has been no consensus about 
the syntax.

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.

Aaaaaah, this was exactly the area I figured would be an issue when I thought about the problem for more than 10 seconds :-)
 
 
I was just wondering if someone has a document detailing the various syntaxes that have been proposed in the the past.

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.

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.

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 :-)

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...

Maybe if I have some time I'll do the archaeology and cobble together a summary of the various proposals...

--
--Guido van Rossum (python.org/~guido)