[Python-Dev] best practices stdlib: purging xrange

James Y Knight foom at fuhm.net
Tue May 8 17:18:44 CEST 2007


On May 8, 2007, at 8:49 AM, Armin Rigo wrote:
> On Tue, May 08, 2007 at 09:14:02AM +1000, Anthony Baxter 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.
>
> I personally think that replacing these with range() is a clean-up,  
> but
> I also know that not everybody agrees to that.  So: should we, or  
> should
> we not, replace xrange() with range() as a matter of clean-up when the
> difference between the two is really completely irrelevant?

But doesn't doing this now this make the conversion to Py3 *harder*?  
If 2to3 is going to rewrite xrange() as range(), and range() to list 
(range()), then moving towards xrange where possible would actually  
be preferable, wouldn't it? Or is there no plan to run 2to3 on the  
stdlib?

James



More information about the Python-Dev mailing list