def create_adder(x): def adder(y): return x + y return adder add_10 = create_adder(10) add_10(3) #=> 13 # 也有匿名函數(shù) (lamda x: x > 2)(3) #=> True # 有一些內(nèi)置的高階函數(shù) map(add_10, [1, 2, 3]) #=> [11, 12, 13] filter(lamda x: x > 5, [3, 4, 5, ...
www.dbjr.com.cn/article/631...htm 2025-6-8