[Python-Dev] xrange vs generators

Thomas Wouters thomas@xs4all.net
Mon, 25 Jun 2001 17:42:12 +0200


On Mon, Jun 25, 2001 at 10:47:50AM -0400, Guido van Rossum wrote:

 [ xrange can't be changed into a generator ]

> This is too bad; I really wish that xrange() could die or be limited
> entirely to for loops.  I wonder if we could put warnings on xrange()
> uses beyond the most basic...?

Why do we want to do this ? xrange() is still exactly what it was: an object
that pretends to be a list of integers. Besides being useful for those who
work a lot with ranges, it's a wondeful example on what you can do with
Python (even if it isn't actually written in Python :-)

I see less reason to deprecate xrange than to deprecate the gopherlib,
wave/aifc/audiodev, mhlib, netrc and/or robotparser modules. 

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!