Hacker News new | ask | show | jobs
by hcrisp 3653 days ago
For simple mathematical operations you can import them as functions:

    from operator import mul, add
    arr = [1, 2, 3]
    sum_of_squares = reduce(add, map(mul, arr, arr))