[Numpy-discussion] Pre-allocate array

2012-12-27 Thread Nikolaus Rath
Hello, I have an array that I know will need to grow to X elements. However, I will need to work with it before it's completely filled. I see two ways of doing this: bigarray = np.empty(X) current_size = 0 for i in something: buf = produce_data(i)

Re: [Numpy-discussion] Pre-allocate array

2012-12-27 Thread Chris Barker - NOAA Federal
On Thu, Dec 27, 2012 at 8:44 AM, Nikolaus Rath nikol...@rath.org wrote: I have an array that I know will need to grow to X elements. However, I will need to work with it before it's completely filled. what sort of work with it do you mean? -- resize() is dangerous if there are any other views