This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: [doc] range is not a built-in function
Type: behavior Stage:
Components: Documentation Versions: Python 3.11, Python 3.10, Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: bgailer, docs@python, slateny, terry.reedy
Priority: normal Keywords: easy

Created on 2019-06-27 15:39 by bgailer, last changed 2022-04-11 14:59 by admin.

Messages (5)
msg346745 - (view) Author: bob gailer (bgailer) Date: 2019-06-27 15:39
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.
msg346753 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-27 16:19
I presume you are referring to 8.3 of the language reference
which has "the built-in function range()".  Types/classes *are* functions, which is why dist, list, range, etc are listed in "Built-in Functions" in the library reference.  But I agree that the more specific term should be used.

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.
msg346784 - (view) Author: bob gailer (bgailer) Date: 2019-06-27 23:00
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.
msg346887 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-29 15:59
Then it appears the indexing could also be improved.
msg416153 - (view) Author: Stanley (slateny) * Date: 2022-03-28 09:10
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 ( might still be a good idea just for convenience.
Date User Action Args
2022-04-11 14:59:17adminsetgithub: 81611
2022-03-28 09:10:10slatenysetnosy: + slateny
messages: + msg416153
2022-03-24 16:13:14iritkatrielsetkeywords: + easy
title: range is not a built-in function -> [doc] range is not a built-in function
versions: + Python 3.10, Python 3.11, - Python 3.7, Python 3.8
2019-06-29 15:59:20terry.reedysetmessages: + msg346887
2019-06-27 23:00:47bgailersetmessages: + msg346784
2019-06-27 16:19:19terry.reedysetnosy: + terry.reedy

messages: + msg346753
versions: + Python 3.9, - Python 3.5, Python 3.6
2019-06-27 15:39:32bgailercreate