[Numpy-discussion] how to build a series of arrays as I go?

Robert Kern robert.kern at gmail.com
Mon Mar 17 13:46:25 EDT 2008


On Mon, Mar 17, 2008 at 12:16 PM, Chris Withers <chris at simplistix.co.uk> wrote:
> Charles Doutriaux wrote:
>  > 1-)You could use the concatenate function to grow an array as you go.
>
>  Thanks. Would it be more efficient to build the whole set of arrays as
>  lists first or build them as arrays and use concatenate?

Appending to a list is almost always better than growing an array by
concatenation. If you have a real need for speed, though, there are a
few tricks you can do at the expense of complexity. However, appending
to a list is really the best practice.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco



More information about the NumPy-Discussion mailing list