FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`math.sumprod` equivalent code is more complicated than needed · Issue #130203 · python/cpython · GitHub

/ cpython Public

math.sumprod equivalent code is more complicated than needed #130203

Description

Documentation

Docs say that math.sumprod(p, q) is roughly equivalent to:

sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))

This is not useful for people who don't already know about itertools.starmap and operator.mul. IMO that is a shame, because math.sumprod is not that complicated to understand. It would be better to describe it as:

sum(x*y for x, y in zip(p, q, strict=True))

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc direasy

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL