With given list:
x = [x for x in range(10)]
Printing out indexes and values:
for i in range(-10, len(x)):
print i, ": ", x[i]
The output is:
-10 : 0
-9 : 1
-8 : 2
-7 : 3
-6 : 4
-5 : 5
-4 : 6
-3 : 7
-2 : 8
-1 : 9
0 : 0
1 : 1
2 : 2
3 : 3
4 : 4
5 : 5
6 : 6
7 : 7
8 : 8
9 : 9
but
print x
returns:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Why is the actual list twice as long as the initialized list?