[Python-ideas] Query about proposed Multi-line Anonymous Function syntaxes

Ethan Furman ethan at stoneleaf.us
Fri Oct 10 20:52:10 CEST 2014


On 10/10/2014 11:42 AM, Guido van Rossum wrote:
>
> 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.

My take on the less-readable-code angle is that one of the main reasons for writing procedures is for abstraction:

   def some_func(spammer, target):
       """
       fraggle the target with spammer
       """

You can look at that signature and have a rough idea of whats happening.  On the other hand, anonymous blocks have the 
serious drawback of blowing your abstraction to bits:

   def some_func( multi_lambda:
       { /* many lines to define spammer /* }
       multi_lambda:
       { /* many lines to retrieve the target /* }
       ):
       { /* many lines to implement some_func /* }

What a readability nightmare.

--
~Ethan~


More information about the Python-ideas mailing list