How much ram does your machine have?
the main point is "except when a very large range is used on a
memory-starved machine"
run
x = range(10 ** 6)
and look at the memory usage of python..
what happens when you run this program:
import time
def t(func, num):
s = time.time()
for x in fun
"TPJ" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "The advantage of xrange() over range() is minimal (since xrange()
> still has to create the values when asked for them) except when a very
> large range is used on a memory-starved machine or when all of the
> range's elements a
TPJ wrote:
> I decided to measure the performance of range and xrange...
>
> The results were as follows:
>
> n rprint xrprint
>
> 10^40.37 s 0.34 s <- (1)
> 10^54.26 s 4.25 s
> 10^642.57 s 42.57 s
> 10^7431.94 s438.32 s
"The advantage of xrange() over range() is minimal (since xrange()
still has to create the values when asked for them) except when a very
large range is used on a memory-starved machine or when all of the
range's elements are never used (such as when the loop is usually
terminated with break)." - f