Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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))


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: