[Tutor] replacing range with xrange

Alan Gauld alan.gauld at btinternet.com
Mon Jan 28 20:32:18 CET 2008

> xrange() is being renamed to range(), so there will be no xrange() 
> and
> range() will return an iterator rather than a list.

That's sad to see, I use range to generate lists of integers
almost as much as I use it for iteration. But maybe I'm
unusual in that respect, I do use Python mainly for
simulations and its ease of creating large test data
sets is one of its nicer features. Having to convert
an iterator into a list is a bit ugly IMHO! I'd have
preferred to see xrange kept as an iterator and range
returning a list. That seems to me more in keeping
with the names too.

Alan G. 

More information about the Tutor mailing list