[Numpy-discussion] How to avoid extra copying when forming an array from an iterator

srean srean.list@gmail....
Fri Jun 24 11:58:27 CDT 2011

On Fri, Jun 24, 2011 at 9:12 AM, Robert Kern <robert.kern@gmail.com> wrote:

> On Fri, Jun 24, 2011 at 04:03, srean <srean.list@gmail.com> wrote:
> > To answer my own question, I guess I can keep appending to a
> array.array()
> > object and get a numpy.array from its buffer if possible.  Is that the
> > efficient way.
> It's one of the most efficient ways to do it, yes, especially for 1D
> arrays.

Thanks for the reply. My first cut was to try cStringIO because I thought I
could use the writelines() method and hence avoid the for loop in the python
code.  It would have been nice if that had worked. If I understood it
correctly the looping would have been in a C function call.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110624/623de9d5/attachment.html 

More information about the NumPy-Discussion mailing list