On 10/10/07, Anne Archibald <[EMAIL PROTECTED]> wrote:
>
> On 11/10/2007, Robert Kern <[EMAIL PROTECTED]> 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?


Have you looked at array.array?

>>> import array
>>> a = array.array('i')
>>> a.append(2)
>>> a.append(7)
>>> a
array('i', [2, 7])




-- 
.  __
.   |-\
.
.  [EMAIL PROTECTED]
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to