[Python-Dev] best practices stdlib: purging xrange

Raymond Hettinger python at rcn.com
Tue May 8 02:57:06 CEST 2007

> 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.
>Any objections?


It isn't "informally deprecated".  The xrange() builtin has different performance characteristics and is still needed in Py2.x.  Only in Py3k where range() becomes lazy like will the need disappear.

Seriously, we should make every effort to make sure that Py3k doesn't unnecessarily backpropagate into an otherwise very stable codebase.  An unwarranted s/xrange/range/g would be just one more reason to not upgrade to Py2.6.


More information about the Python-Dev mailing list