Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

Terry Reedy tjreedy at udel.edu
Wed Feb 17 23:59:14 CET 2010


On 2/17/2010 5:46 PM, Lawrence D'Oliveiro wrote:
> In message<hlhdsi$2pn$1 at theodyn.ncf.ca>, cjw wrote:
>
>> Aren't lambda forms better described as function?
>
> Is this a function?
>
>      lambda : None
>
> What about this?
>
>      lambda : sys.stdout.write("hi there!\n")

To repeat: Python lambda expressions evaluate to function objects 
identical, except for .__name__ attribute, to the equivalent def statememnt.

 >>> type(lambda:None)
<class 'function'>
 >>> import sys
 >>> type(lambda : sys.stdout.write("hi there!\n"))
<class 'function'>






More information about the Python-list mailing list