今天在看書的時候,看到了這樣的一條語句:express
if isinstance(value,int) or isinstance(value,float): split_function=lambda row:row[column]>=value
對其中的lambda這個函數表示很不明白,因而看了看Python文檔,文檔中解釋以下:函數
log2=lambda x:log(x)/log(2)
就是定義了一個以2爲底的對數函數。這個例子是有參數的,還有一種狀況是沒有參數的:this
>>>bar=lambda :'this is a bar' >>>print bar this is a bar