Поиск Google ничего не нашел

Good guess: they did change something. Range used to return a list, and now it returns an iterable range object, very much like the old xrange. >>> range(10) range(0, 10).


r[i:i+1] = [] TypeError: 'range' object does not support item assignment. Not sure why it is throwing this exception, did they change something in Python 3.2?


This article explains the new features in Python 2.3. Python 2.3 was released on July 29, 2003.


Using range function to loop throught array and list data


In python 3, range replaces xrange so that.


As you have seen now that type([]) is giving us a list. This means that '[]' is a list as mentioned above.


The __contains__ method for range objects in Python 3.


This seemed like a nice example of how the dictionary data type can be used in Python. Is there is an even more code-efficient way to do this?


The built-in range function in Python is very useful to generate sequences of numbers in the form of a list. The given end point is never part of the generated list; range(10) generates a list of 10 values, the legal indices for items of a sequence of length 10.


In Python versions before 3, range() creates a list, as you say. In Python 3, it creates a generator. Effectively, what they did going from 2 -> 3 was to remove xrange() and make range() do the same thing xrange() used to do.