Skip to content

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

@Akuli

Description

@Akuli

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