[Python-Dev] best practices stdlib: purging xrange

Guido van Rossum guido at python.org
Tue May 8 02:03:43 CEST 2007


But why bother? The 2to3 converter can do this for you.

In a sense using range() is more likely to produce broken results in
3.0: if your code depends on the fact that range() returns a list, it
is broken in 3.0, and 2to3 cannot help you here. But if you use
list(xrange()) today, the converter will turn this into list(range())
in 3.0 and that will continue to work correctly.

--Guido

On 5/7/07, Anthony Baxter <anthony at interlink.com.au> wrote:
> I'd like to suggest that we remove all (or nearly all) uses of
> xrange from the stdlib. A quick scan shows that most of the usage
> of it is unnecessary. With it going away in 3.0, and it being
> informally deprecated anyway, it seems like a good thing to go away
> where possible.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list