Skip to content

Fix docstring copy-paste error in maths/sumset.py - #15052

Merged
cclauss merged 1 commit into
TheAlgorithms:masterfrom
satyamkumar-builds:fix/15013-sumset-docstring
Aug 25, 2026
Merged

Fix docstring copy-paste error in maths/sumset.py#15052
cclauss merged 1 commit into
TheAlgorithms:masterfrom
satyamkumar-builds:fix/15013-sumset-docstring

Conversation

@satyamkumar-builds

Copy link
Copy Markdown

Describe your change:

The docstring of sumset() in maths/sumset.py contained a copy-paste error from maths/sylvester_sequence.py:

  • The return description said "the nth number in Sylvester's sequence" — but the function computes a sumset, a completely different mathematical concept.
  • The param names (first set, second set) did not match the actual parameter names (set_a, set_b).

Fixed both so the docstring now accurately describes the parameters and the return value:

:param set_a: a set of numbers
:param set_b: a set of numbers
:return: the sumset of set_a and set_b (all pairwise sums a + b)

No code logic changed — documentation fix only. All existing doctests pass.

Fixes #15013

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Does your submission pass tests?   (documentation only change; doctests pass locally)

The docstring incorrectly referenced Sylvester's sequence (a copy-paste
error from maths/sylvester_sequence.py) and used param names that did
not match the actual function signature.

Fixes TheAlgorithms#15013
@algorithms-keeper algorithms-keeper Bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Aug 18, 2026

@priya-sundaram-dev priya-sundaram-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — correct fix. The old :param first set: / :param second set: didn't match the real parameter names (set_a, set_b), and the :return: was copy-pasted from sylvester_sequence.py ("nth number in Sylvester's sequence") which has nothing to do with a sumset. The new text accurately describes the pairwise-sum set, and the existing doctests already cover behavior. Small, clean docs correction — thanks @satyamkumar-builds. 🤖 #ABotWroteThis

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Looks good to me.

@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Aug 25, 2026

@priya-sundaram-dev priya-sundaram-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The old docstring was a copy-paste from a Sylvester's-sequence function and didn't match the code. The new :param set_a/:param set_b names line up with the actual signature, and the sumset of set_a and set_b (all pairwise sums a + b) correctly describes the behaviour — confirmed by the existing doctests ({1,2,3}+{4,5,6} → {5,6,7,8,9}). Docs-only, no behaviour change. LGTM. 👍

@cclauss
cclauss merged commit 25a312d into TheAlgorithms:master Aug 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: maths/sumset.py docstring incorrectly references Sylvester's sequence

4 participants