[Numpy-discussion] First Numerical Python code...comments?

Steven H. Rogers steve at shrogers.com
Sun Mar 4 14:08:50 EST 2007


Charles R Harris wrote:
> 
> 
> On 3/4/07, *Alan G Isaac* <aisaac at american.edu 
> <mailto:aisaac at american.edu>> wrote:
> 
>     On Sun, 4 Mar 2007, Charles R Harris apparently wrote:
>      > range is now iterable and I read
>      > somewhere that xrange is deprecated.
> 
>     There has been a rumor that range will effectively become
>     xrange in Python 300
>     http://www.python.org/doc/essays/ppt/accu2006/Py3kACCU.ppt
>     but range has always been iterable---did you mean to say
>     "iterator"? but xrange objects to not support a next()
>     method either---and as of Python 2.5 xrange is not
>     deprecated (unless the documentation somehow got out of
>     sync).
>     http://docs.python.org/lib/built-in-funcs.html
>     <http://docs.python.org/lib/built-in-funcs.html>
> 
> 
> My impression was that the traditional range returned a list and then 
> the iteration proceeded over the list, and that has changed, just as it 
> is no longer necessary to use the xreadlines method for files to iterate 
> over the lines. I don't recall where I read this stuff. Hmm, but maybe 
> you are right, that this is planned for python 3.0 but maybe not yet in 
> current versions of python. From a ppt presentation by Guido:
> 
> dict.keys(), range(), zip() won't return lists
> killing dict.iterkeys(), xrange(), itertools.izip()
> 
> Chuck
> 

At PyCon, Guido said that range would have xrange behavior and the old 
range would be deprecated in Python 3.0.  This may be back-ported to 2.6.

# Steve





More information about the NumPy-Discussion mailing list