6
I asked that question here How to format all elements of a list in Python?.
In one of the answers, @Ciganomorrisonmendez, put the following excerpt:
list(range(1, 10))
But every time I used the Python
, I used to
range(1, 10)
This is a conversion to list
? But the range
no longer returns a list
?
Updating
I ran a test on the command line and the result that was returned was this:
type(range(1, 10))
<type 'list'>
Take a look at the update. The terminal is saying that it is a list!
– Wallace Maxters
It is written that range is currently a type of immutable sequence. This "currently" means "has been modified in recent versions"?
– Wallace Maxters
Yes, I’ll improve the answer.
– Leonel Sanches da Silva
Just to top it off - some tools that update code to work simultaneously with Python 2 and Python 3 change the occurrences of
range
in Python 2 tolist(range(...))
- so that the behaviour is identical in both versions.– jsbueno