Confessions of a Python fanboy

Falcolas garrickp at
Fri Jul 31 12:53:44 EDT 2009

On Jul 31, 3:49 am, Masklinn <maskl... at> wrote:
> On 31 Jul 2009, at 10:25 , Chris Rebert wrote:> On Fri, Jul 31, 2009 at 1:21 AM, Xavier Ho<cont... at>  
> > wrote:
> >> On Fri, Jul 31, 2009 at 6:08 PM, Masklinn <maskl... at>  
> >> wrote:
> >>> <snip>... but since Python doesn't have anonymous functions that  
> >>> usage
> >>> tends to be a bit too verbose ... <snip>
> >> Sorry to interrupt, but wouldn't lambda in Python be considered as
> >> 'anonymous functions'?
> > I believe "full" anonymous functions was intended by the author.
> > lambdas are limited to a single expression.
> Yes, and they're limited to a single *expression*, so before Python 3,  
> lambda: print "foo" is out. Likewise, it isn't possible to have an if/
> else statement within a lambda (though a ternary is ok), or a with, …  
> since Python statements aren't expressions.

Perhaps you can't do lambda foo: print foo, but you *can* do lambda x:

Combined with the ternary if, it seem sufficient if you want to stick
to the ideal "Simple is better than Complex". Sure, with statements
allowed in anonymous functions, you can save on a line of typing (def
blargh(x):), but I don't feel the obfuscation is worth the cost.


More information about the Python-list mailing list