Confessions of a Python fanboy
Masklinn
masklinn at masklinn.net
Fri Jul 31 05:49:31 EDT 2009
On 31 Jul 2009, at 10:25 , Chris Rebert wrote:
> On Fri, Jul 31, 2009 at 1:21 AM, Xavier Ho<contact at xavierho.com>
> wrote:
>> On Fri, Jul 31, 2009 at 6:08 PM, Masklinn <masklinn at masklinn.net>
>> 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.
More information about the Python-list
mailing list