-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
gh-125897: Use positional-only parameter indicators for range()
#125945
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
Conversation
Addresses the python#125897 documentation discrepancy that the range function accepts step as a kwarg
99bbb0c
to
26e2f2c
Compare
@kbaikov, please avoid force-pushes: https://devguide.python.org/getting-started/pull-request-lifecycle |
A friendly ping. Is there any decision on this issue/PR? How do i proceed? |
CC @nedbat Perhaps, https://devguide.python.org/documentation/style-guide/#function-signatures requires a clarification. Is this for new code? How we should handle current sphinx docs, that use funny square bracket syntax? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. class:: range(stop) | ||
range(start, stop, step=1) | ||
.. class:: range(stop, /) | ||
range(start, stop, step=1, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think enumerating all three cases is slightly nicer. The step
argument is for advanced use-cases. Thoguhts @terryjreedy?
range(start, stop, step=1, /) | |
range(start, stop, /) | |
range(start, stop, step, /) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally prefer fewer lines, partly from experience with IDLE call tips (which would be similar in other IDEs). Serhiy generally went with fewer in his PR, as he did here, except where really needed. Two are really needed here, since the true Python-implementaton signature (start_or_stop, stop_if_needed=None, step=1, /)
is definitely too baroque for the doc.
Given your approval, I will merge this and backport (as Serhiy plans to backport his changes).
range()
range()
range()
Thanks @kbaikov for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…ythonGH-125945) (cherry picked from commit 0c83daa) Co-authored-by: Konstantin Baikov <[email protected]>
…ythonGH-125945) (cherry picked from commit 0c83daa) Co-authored-by: Konstantin Baikov <[email protected]>
GH-137652 is a backport of this pull request to the 3.14 branch. |
GH-137653 is a backport of this pull request to the 3.13 branch. |
…H-125945) (#137653) Co-authored-by: Konstantin Baikov <[email protected]>
* main: pythongh-137288: Update 3.14 magic numbers (pythonGH-137665) pythongh-135228: When @DataClass(slots=True) replaces a dataclass, make the original class collectible (take 2) (pythonGH-137047) pythongh-126008: Improve docstrings for Tkinter cget and configure methods (pythonGH-133303) pythongh-131885: Use positional-only markers for ``max()`` and ``min()`` (python#131868) pythonGH-137426: Remove code deprecation of `importlib.abc.ResourceLoader` (pythonGH-137567) pythongh-125897: Mark range function parameters as positional only (python#125945) pythongh-137400: Fix a crash when disabling profiling across all threads (pythongh-137471) pythongh-115766: Fix IPv4Interface.is_unspecified (pythonGH-137326) pythongh-128813: cleanup C-API docs for PyComplexObject (pythonGH-137579) pythongh-135953: Profile a module or script with sampling profiler (python#136777) Fix documentation of hash in PyHash_FuncDef (python#137595)
Addresses the #125897 documentation discrepancy that the range function accepts step as a kwarg
📚 Documentation preview 📚: https://cpython-previews--125945.org.readthedocs.build/
range
params discrepancy across versions #125897