[Python-ideas] Ruby-style Blocks in Python Idea

Terry Reedy tjreedy at udel.edu
Tue Mar 10 00:09:52 CET 2009


Aahz wrote:
> On Mon, Mar 09, 2009, Sturla Molden wrote:
>> I see no reason for introducing two new keywords to do this, as you are  
>> really just enhancing the current lambda keyword.
>>
>> On the other hand, turning blocks into anonymous functions would be very  
>> useful for functional programming. As such, I like your suggestion.
> 
> There's a substantial minority (possibly even a majority) in the Python
> community that abhors functional programming.

I am not one of them, if there really are such.

> Even among those who like functional programming,
 > there's a substantial population that dislikes
> extensive use of anonymous functions.

Like many other Pythonistas I recognize that that an uninformative stock 
name of '<lambda>' is defective relative to an informative name that 
points back to readable code.  What I dislike is the anonymity-cult 
claim that the defect is a virtue.

Since I routinely use standard names 'f' and 'g' (from math) to name 
functions whose name I do not care about, I am baffled (and annoyed) by 
(repeated) claims such as "Having to name a one-off function adds 
additional cognitive overload to a developer." (Tav).  Golly gee, if one 
cannot decide on standard one-char name, how can he manage the rest of 
Python?

(I also, like others, routinely use 'C' for class and 'c' for C 
instance.  What next?  A demand for anonymous classes? Whoops, I just 
learned that Java has those.)

But I have no problem with the use of lambda expressions as a 
convenience, where appropriate.

Terry Jan Reedy




More information about the Python-ideas mailing list