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

Charles R Harris charlesr.harris at gmail.com
Sun Mar 4 12:46:55 EST 2007


On 3/4/07, Alan G Isaac <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


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070304/b393abf3/attachment.html>


More information about the NumPy-Discussion mailing list