GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-125897: Use positional-only parameter indicators for ``range()`` by kbaikov · Pull Request #125945 · python/cpython

Conversation

@kbaikov

@kbaikov kbaikov commented Oct 24, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Addresses the #125897 documentation discrepancy that the range function accepts step as a kwarg


📚 Documentation preview 📚: https://cpython-previews--125945.org.readthedocs.build/

  • Issue: Built-in function range params discrepancy across versions #125897

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ghost

ghost commented Oct 24, 2024 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels Oct 24, 2024
@mpage mpage changed the title gn-125897: FIx the range function refering to step as a kwarg gh-125897: FIx the range function refering to step as a kwarg Oct 24, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Oct 24, 2024
Built-in function range params discrepancy across versions #125897
Closed
@mpage mpage changed the title gh-125897: FIx the range function refering to step as a kwarg gh-125897: Fix the range function refering to step as a kwarg Oct 24, 2024
skirpichev
skirpichev reviewed Oct 25, 2024
View reviewed changes
Comment thread Doc/library/functions.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kbaikov
gh-125897: Fix the range function refering to step as a kwarg
26e2f2c
Addresses the #125897 documentation discrepancy that the range function accepts step as a kwarg
@skirpichev

skirpichev commented Oct 25, 2024

Copy link
Copy Markdown
Member

@kbaikov, please avoid force-pushes: https://devguide.python.org/getting-started/pull-request-lifecycle

kbaikov and nineteendo reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev approved these changes Oct 25, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Oct 25, 2024
travis-pds
travis-pds reviewed Oct 25, 2024
View reviewed changes
Comment thread Doc/library/functions.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kbaikov

kbaikov commented Dec 9, 2024

Copy link
Copy Markdown
Contributor Author

A friendly ping. Is there any decision on this issue/PR? How do i proceed?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev

skirpichev commented Feb 6, 2025

Copy link
Copy Markdown
Member

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@merwok merwok changed the title gh-125897: Fix the range function refering to step as a kwarg gh-125897: Fix range function doc referring to step as a kwarg Feb 24, 2025
@skirpichev skirpichev mentioned this pull request Mar 29, 2025
gh-131885: Updates docs to make max and min iterable param positional only #131868
Merged
@skirpichev skirpichev mentioned this pull request Aug 10, 2025
gh-137609: Update signatures of builtins in the documentation #137610
Merged
terryjreedy
terryjreedy approved these changes Aug 11, 2025
View reviewed changes

@terryjreedy terryjreedy left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

In #137610, Serhiy proposes to put /s everywhere they belong, and I strongly support this. HIs PR #137609 includes the 2 additions here, so he also approves them. I think that this should be merged first so that OP gets the proper credit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Aug 11, 2025
AA-Turner
AA-Turner approved these changes Aug 11, 2025
View reviewed changes
Comment thread Doc/library/functions.rst
.. class:: range(stop)
range(start, stop, step=1)
.. class:: range(stop, /)
range(start, stop, step=1, /)

@AA-Turner AA-Turner Aug 11, 2025

Copy link
Copy Markdown
Member

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?

Suggested change
range(start, stop, step=1, /)
range(start, stop, /)
range(start, stop, step, /)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@terryjreedy terryjreedy Aug 11, 2025

Copy link
Copy Markdown
Member

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).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AA-Turner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@terryjreedy terryjreedy added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Aug 11, 2025
@AA-Turner AA-Turner changed the title gh-125897: Fix range function doc referring to step as a kwarg gh-125897: Use positional-only parameter indicators for range() Aug 11, 2025
@AA-Turner AA-Turner changed the title gh-125897: Use positional-only parameter indicators for range() gh-125897: Use positional-only parameter indicators for range() Aug 11, 2025
@terryjreedy
terryjreedy merged commit 0c83daa into python:main Aug 11, 2025
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Aug 11, 2025
@miss-islington-app

miss-islington-app Bot commented Aug 11, 2025

Copy link
Copy Markdown

Thanks @kbaikov for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Aug 11, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 11, 2025
@kbaikov @miss-islington
pythongh-125897: Mark range function parameters as positional only (p…
45ea51a
…ythonGH-125945)

(cherry picked from commit 0c83daa)

Co-authored-by: Konstantin Baikov <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 11, 2025
@kbaikov @miss-islington
pythongh-125897: Mark range function parameters as positional only (p…
5bea319
…ythonGH-125945)

(cherry picked from commit 0c83daa)

Co-authored-by: Konstantin Baikov <[email protected]>
@bedevere-app

bedevere-app Bot commented Aug 11, 2025

Copy link
Copy Markdown

GH-137652 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 11, 2025
@bedevere-app

bedevere-app Bot commented Aug 11, 2025

Copy link
Copy Markdown

GH-137653 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Aug 11, 2025
AA-Turner pushed a commit that referenced this pull request Aug 11, 2025
@miss-islington @kbaikov
[3.13] gh-125897: Mark range function parameters as positional only (G…
8531f5b
…H-125945) (#137653)

Co-authored-by: Konstantin Baikov <[email protected]>
maurycy added a commit to maurycy/cpython that referenced this pull request Aug 12, 2025
@maurycy
Merge branch 'main' into csv-sniffer-counter-set
11c891d
* 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)
@kbaikov
kbaikov deleted the fix-issue-125897 branch August 12, 2025 22:25
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@kbaikov @Agent-Hellboy
pythongh-125897: Mark range function parameters as positional only (p…
abbb4f8
…ython#125945)
hugovk pushed a commit that referenced this pull request Sep 11, 2025
@miss-islington @kbaikov
[3.14] gh-125897: Mark range function parameters as positional only (G…
735ac97
…H-125945) (#137652)

Co-authored-by: Konstantin Baikov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra left review comments
@skirpichev skirpichev skirpichev approved these changes
@willingc willingc willingc left review comments
@terryjreedy terryjreedy terryjreedy approved these changes
@chris-eibl chris-eibl chris-eibl left review comments
@AA-Turner AA-Turner AA-Turner approved these changes
+1 more reviewer
@travis-pds travis-pds travis-pds left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@kbaikov @skirpichev @JelleZijlstra @willingc @AA-Turner @terryjreedy @travis-pds @chris-eibl
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.