Skip to content

Comments

fix: correct docstrings in prime_numbers.py (list -> generator, grammar fix)#14300

Open
23f2000188 wants to merge 2 commits intoTheAlgorithms:masterfrom
23f2000188:fix/docstring-correct-return-type-prime-numbers
Open

fix: correct docstrings in prime_numbers.py (list -> generator, grammar fix)#14300
23f2000188 wants to merge 2 commits intoTheAlgorithms:masterfrom
23f2000188:fix/docstring-correct-return-type-prime-numbers

Conversation

@23f2000188
Copy link

Description

The docstrings for slow_primes(), primes(), and fast_primes() in maths/prime_numbers.py incorrectly stated:

"Return a list of all primes numbers up to max."

There are two issues:

  1. Incorrect return type description: All three functions are annotated as -> Generator[int] and yield values — they return a generator, not a list.
  2. Grammar error: "primes numbers" should be "prime numbers".

Fix

Changed all three occurrences from:

Return a list of all primes numbers up to max.

to:

Return a generator of all prime numbers up to max_n.

Checklist

  • The fix is in documentation/docstrings only
  • No logic changes
  • Consistent with the actual return type annotation Generator[int]
  • Grammar corrected

The docstrings for slow_primes(), primes(), and fast_primes()
incorrectly stated 'Return a list of all primes numbers up to max.'
However, all three functions return a Generator[int], not a list.
Also fixed the grammar: 'primes numbers' -> 'prime numbers'.
The docstrings for slow_primes(), primes(), and fast_primes()
incorrectly stated 'Return a list of all primes numbers up to max.'
However, all three functions return a Generator[int], not a list.
Also fixed the grammar: 'primes numbers' -> 'prime numbers'.
@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant