Apr-28-2017, 08:49 AM
(Apr-28-2017, 08:35 AM)wavic Wrote: Except it returns a list:Isnt it exactly what i posted?
In [1]: list(range(5)) Out[1]: [0, 1, 2, 3, 4]
(Apr-28-2017, 08:30 AM)zivoni Wrote:I tried to write second sentence as some sort of "unreal conditional", but my english is pretty weak...list()
used on iterable returns list containing items from that iterable,..
...
if it always returned list containing its argument, usinglist(range(5))
would give you list containing range generator instead of[0, 1, 2, 3, 4]
.