|
|
|
|
|
by brianwawok
3653 days ago
|
|
Is there a more Pythonic way to do it? Lambdas are cool but usually not the first place you go in Python. I would think something like (my best guess, not a Python pro)... sum_of_squares = sum([x*x for x in arr])
Which I think is easier to read than either example post above.Of course you will point out that this is less powerful than full map and reduce.. but meh... pros and cons to both styles |
|