GH-100485: Add math.sumprod() by rhettinger · Pull Request #100677 · python/cpython · GitHub

github.com

Tin mới

rhettinger:sumprod

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

Consider adding sumproduct() or dotproduct() to the math module #100485

Core fuctionality without error handling

Test core functionality.

Check for non-iterable inputs

Handle uneven lengths and error returns from PyIter_Next().

Handle errors arising during the multiplications or additions.

Test special values

awaiting core review

awaiting core review

Regenerate clinic files

🔨 test-with-buildbots

🔨 test-with-buildbots

🔨 test-with-refleak-buildbots

🔨 test-with-refleak-buildbots

Beautify with booleans.

Add int_path. Needs work on refcount and addition overflow.

Add more assertions and refcount fixes

Only test for ints when iterators are not stopped.

Test long addition for overflow

Improve wording regarding extended precision.

Add the "finished" summary variable for readability.

Fully encapsulate the dl (double length) logic.

Add performance comment.

Abbreviate comment.

Remove case for int/int while float in use.

Update itertools recipe to reflect the promotion.

Remove doctest for dotproduct().

Speed-up iterator access. Let float be selected by bools.

Add assertion for a key checkpoint

Move dl_mul() out to a separate function. Dekker (5.8).

Add the smaller magnitude component first.

Use Dekker (5.12) directly. Avoids calling dl_add() and saves a compa…

Update timing in comment.