Högre ordningens funktioner Python har lambda för att skapa anonyma funktioner Kroppen är ett uttryck, inte ett kommando! Python har map, filter och reduce map(lambda x: x*10, [1,2,3,4]) # -> [10,20,30,40] filter(lambda x: x % 2, [1,2,3,4]) # -> [1,3] map(lambda x: x*10, filter(lambda x: x % 2, [1,2,3,4])) # -> [10,30] reduce(lambda x,y: x*y, [1,2,3,4]) # -> 24 reduce(operator.mul, [1,2,3,4]) # -> 24