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

Charles R Harris charlesr.harris@gmail....
Sun Mar 4 09:59:09 CST 2007


On 3/3/07, Francesc Altet <faltet@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://projects.scipy.org/pipermail/numpy-discussion/attachments/20070304/df94ecb9/attachment.html 


More information about the Numpy-discussion mailing list