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

Charles R Harris charlesr.harris at gmail.com
Sun Mar 4 10:59:09 EST 2007


On 3/3/07, Francesc Altet <faltet at carabos.com> wrote:
<snip>

>
> > # Fill in SK with proper values
> > for i in range(numel):
>
> Always try to use xrange(numel) instead of range(numel). range() will
> return you a python list, and for large values of numel these can take
> precious amounts of memory. On his part, xrange() returns an iterator,
> and it never takes more than a few bytes.


I believe that is no longer the case, range is now iterable and I read
somewhere that xrange is deprecated.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070304/df94ecb9/attachment.html>


More information about the NumPy-Discussion mailing list