Teaching the "range" function in Python 3

MRAB python at mrabarnett.plus.com
Fri Jun 30 23:25:40 EDT 2017


On 2017-07-01 03:12, Stefan Ram wrote:
> Terry Reedy <tjreedy at udel.edu> writes:
>>range is a class, not a function in the strict sense.
> 
>        »the built-in function range() returns an iterator of integers«
> 
>      The Python Language Reference, Release 3.6.0, 8.3 The for statement
> 
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> range
<class 'range'>

I think it's a holdover from Python 2:

Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> range
<built-in function range>
 >>> xrange
<type 'xrange'>



More information about the Python-list mailing list