-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
[doc] range is not a built-in function #81611
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
In section 8.3 The for statement there is a reference to range as a built-in function. That was true in python 2. Now range is a built-in type. |
I presume you are referring to 8.3 of the language reference To me, the more severe problem is with the complete sentence. "Hint: the built-in function range() returns an iterator of integers suitable to emulate the effect of Pascal’s for i := a to b do; e.g., list(range(3)) returns the list [0, 1, 2]." The now obsolete definition of Python in terms of the now obscure Pascal should be deleted here and anywhere else such remains. I think the whole sentence should just be deleted. The whole paragraph and example could otherwise be improved. |
Thanks for explaining. Indeed range appears in __builtins__. It is a surprise to type range and get <class 'range'> in response. sum otoh gives <built-in function sum>. The distinction between function, type and class seems muddy. When I enter "range" in the index box in the windows documentation display I am offered: (1)built-in function, which takes me to the paragraph that started this issue. It does NOT take me to the built-in functions topic, whereas sum does. (2) object, and range (built-in class)which take me to the built-in types topic. This seems to add to the confusion. |
Then it appears the indexing could also be improved. |
Terry, how do you think the example/paragraph should be improved? I notice that the previous paragraphs talk about continue/break/else, so were you looking for some new example with all those? And I think the indexing's been fixed by now, but a clickable link to the range() documentation (https://docs.python.org/3/library/stdtypes.html#range) might still be a good idea just for convenience. |
) Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
pythonGH-98353) (cherry picked from commit 8b1f125) Co-authored-by: 4l4k4z4m <[email protected]> Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
pythonGH-98353) (cherry picked from commit 8b1f125) Co-authored-by: 4l4k4z4m <[email protected]> Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
…ce (GH-98353) (#100704) gh-81611: Improve `range` paragraph in 8.3 of language reference (GH-98353) (cherry picked from commit 8b1f125) Co-authored-by: 4l4k4z4m <[email protected]> Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
…ce (GH-98353) (#100705) gh-81611: Improve `range` paragraph in 8.3 of language reference (GH-98353) (cherry picked from commit 8b1f125) Co-authored-by: 4l4k4z4m <[email protected]> Co-authored-by: Kumar Aditya <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
Kumar, in my opinion, issues should not be closed until the backports are merged. |
Yeah, I usually approve backports and close the issue but because of the CLA issues PRs were delayed this time. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
range
paragraph in 8.3 of language reference #98353range
paragraph in 8.3 of language reference (GH-98353) #100704range
paragraph in 8.3 of language reference (GH-98353) #100705The text was updated successfully, but these errors were encountered: