|
Not really a fan of the lambda syntax in Python. Comparison: JavaScript: let arr = [1, 2, 3]
let sumOfSquares = arr.map(n => n * n).reduce((a, b) => a + b) // 14
Python: arr = [1, 2, 3]
sum_of_squares = reduce(lambda a, b: a + b, map(lambda n: n * n, arr)) # 14
|
Of course you will point out that this is less powerful than full map and reduce.. but meh... pros and cons to both styles