I read this if we want to create a list of 1000000 numbers than using range(1000000) is not a cool idea because that will take a lot memory and soon as this range() is called it creates a list of that input size whereas xrange(1000000) would be better as it creates the values as needed
Say i have this little program:
for i in xrange(1000000):
print i
Does this create the next position in the list every time the for
loop is called not at the time when we called xrange(1000000)
?