Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trac #34920: Fix description of inputs of primes. #35215

Merged
merged 1 commit into from
Apr 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/sage/arith/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ def eratosthenes(n):
return [ZZ(2)] + [ZZ(x) for x in s if x and x <= n]


def primes(start, stop=None, proof=None):
def primes(start=2, stop=None, proof=None):
r"""
Return an iterator over all primes between start and stop-1,
inclusive. This is much slower than ``prime_range``, but
Expand All @@ -1027,10 +1027,11 @@ def primes(start, stop=None, proof=None):

INPUT:

- ``start`` - an integer - lower bound for the primes
- ``start`` - an integer (default: 2) optional argument -
giving lower bound for the primes

- ``stop`` - an integer (or infinity) optional argument -
giving upper (open) bound for the primes
- ``stop`` - an integer (or infinity) - giving upper (open) bound for the
primes
Comment on lines +1030 to +1034
Copy link
Contributor

Choose a reason for hiding this comment

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

I see your point mathematically. On the other hand, stop is actually an optional argument in the code sense. Should you change the argument to the function rather than changing the docs?

Then see this SO post for keeping the user interface the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I change the signature to primes(start=2, stop=None, proof=None) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thats what I was thinking.


- ``proof`` - bool or None (default: None) If True, the function
yields only proven primes. If False, the function uses a
Expand Down