[Numpy-discussion] appending extra items to arrays

Anne Archibald peridot.faceted@gmail....
Wed Oct 10 23:58:25 CDT 2007

On 11/10/2007, Robert Kern <robert.kern@gmail.com> wrote:

> Appending to a list then converting the list to an array is the most
> straightforward way to do it. If the performance of this isn't a problem, I
> recommend leaving it alone.

Just a speculation:

Python strings have a similar problem - they're immutable, and so are
even more resistant to growth than numpy arrays. For those situations
where you really really want to grow a srting, python provides
StringIO, where you keep efficiently adding to the string, then
finalize it to get the real string out. Would something analogous be
interesting for arrays?


P.S. A (somewhat) slow python implementation would be fairly easy to write. -A

More information about the Numpy-discussion mailing list