Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
kbaikov commented Oct 24, 2024 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
ghost commented Oct 24, 2024 • edited by ghost
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by ghost
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Addresses the python#125897 documentation discrepancy that the range function accepts step as a kwarg
99bbb0c to 26e2f2cCompareskirpichev commented Oct 25, 2024
@kbaikov, please avoid force-pushes: https://devguide.python.org/getting-started/pull-request-lifecycle |
Uh oh!
There was an error while loading. Please reload this page.
kbaikov commented Dec 9, 2024
A friendly ping. Is there any decision on this issue/PR? How do i proceed? |
skirpichev commented Feb 6, 2025
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? |
terryjreedy left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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()0c83daa into python:mainUh oh!
There was an error while loading. Please reload this page.
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 <konstantin.baikov@gmail.com>
…ythonGH-125945) (cherry picked from commit 0c83daa) Co-authored-by: Konstantin Baikov <konstantin.baikov@gmail.com>
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. |
* 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/
rangeparams discrepancy across versions #125897