-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Built-in function range
params discrepancy across versions
#125897
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
Comments
range
params discrepancyrange
params discrepancy across versions
Yeah, you're right, it should be |
Addresses the python#125897 documentation discrepancy that the range function accepts step as a kwarg
@ZeroIntensity Hmmm... I'm certainly neither an expert nor authority to say what something should (or shouldn't) be; however, From the docs:
Why is (I'm genuinely asking, by the way. Hopefully I'm not coming off as sarcastic.) |
It was Back then it was changed to |
Shouldn't the |
Addresses the python#125897 documentation discrepancy that the range function accepts step as a kwarg
I thought about that, but it doesn't seem like the functions page uses the |
Yes, I see. ISTM that after issue #91485 / PR #96579, the Hence the asymmetry. Just wanted to note and see how others think about it :) But this is most probably not in the scope of this issue ... |
What I specifically wanted to draw attention to: #99476 dropped many trailing |
Now there is Python Documentation Editorial Board decision: https://discuss.python.org/t/editorial-board-decisions/58580 #99476 looks wrong for me. |
I think that reverting the patch as a whole - is a separate issue. @nedbat, what do you think on this? But range() issue case shows, that #99476 actually not make the functions page "readable again". Syntax like Take look on the tutorial section 4.9. More on Defining Functions. Hardly after reading about default values and keyword arguments people can expect that function declaration like If we wish to keep "readable" syntax, we could actually change argument processing to support keyword arguments. This come with a performance penalty, but not too big (1-3% percent with AC). |
I'm sorry if this has already been reported. I'm sure it's very low on any list of priorities but it should be an easy one.
I noticed that when doing a Google search for "python built in functions" I am presented with two official results:
On the
functions
page, clicking onrange
takes you to https://docs.python.org/3/library/functions.html#func-range . It looks like, as of 3.11, range acceptsstep
as a kwarg. This is inconsistent with thestdtypes
page which showsstep
as an optional, positional arg through 3.13.functions:
stdtypes:
source:
I didn't see any mention of this change in What’s New In Python 3.11 and it surprised me that a built-in would be changed in such a way.
I pulled a 3.11 docker image and it would seem
step
is not a kwarg.tl;dr - The
functions
page incorrectly states that therange
function acceptsstep
as a kwarg.Linked PRs
The text was updated successfully, but these errors were encountered: