Why anonymity? [was Re: map/filter/reduce/lambda opinions and background unscientific mini-survey]

Duncan Booth duncan.booth at invalid.invalid
Thu Jul 7 11:46:23 EDT 2005


Steven D'Aprano wrote:

> Put it this way: whenever I see a two-line def as above, I can't help
> feeling that it is a waste of a def. ("Somebody went to all the trouble
> to define a function for *that*?") Yet I would never think the same about
> a lambda -- lambdas just feel like they should be light-weight. 

Obviously we think differently there. I don't see why lambdas are any 
different than single expression functions. I certainly don't think of them 
as lighter weight; they take just as long to call; and they involve just as 
much stack setup/tear down. On the other hand I don't consider functions as 
heavyweight, I'm happy to define short helper functions anywhere I think it 
makes the code more expressive.

> Am I just weird?

No, just different[*]. There's nothing wrong with different.

[*] conclusion based entirely on your postings here. I have no evidence 
beyond that.




More information about the Python-list mailing list