Re: Python 3000 Status Update (Long!)
Posted: Aug 1, 2007 4:54 PM
> On the topic of range becoming xrange:
> I think this is a good change in general but it seems like
> there are some specific cases where you still want a list
> of numbers and creating it directly via something like the
> current range() is presumably much more efficient than
> something like list(xrange()).
The difference isn't that great:
$ python -m timeit 'range(100000)'
100 loops, best of 3: 2.5 msec per loop
$ python -m timeit 'list(xrange(100000))'
100 loops, best of 3: 2.9 msec per loop
That was Python 2.4; 2.5 is about the same.
Python 3.0 is *currently* more than 10x slower, but I suspect that's a matter of long integers more than iterators, and the solution is to optimize long integers.