[Numpy-discussion] A numpy accumulator...

Christopher Barker Chris.Barker@noaa....
Tue Oct 6 00:15:31 CDT 2009

Tom K. wrote:
> Chris - I really like this and find it useful.  I would change the name to
> something like "growable" or "ArrayList"

hmm. I think I like "growable" or maybe "growarray".

> I think the right amount to grow is 2x - 

I think that may be too much.. one if the key advantages of this over 
python lists is that there should be a memory use advantage -- when you 
are pushing memory bounds, using twice what you need is a bit much.

>  Perhaps the configurable grow ratio is a good
> thing, although giving a knob means people are going to set it wrong.

maybe, but most folk will use the default anyway. I'm certainly going to 
keep it configurable while under development -- the better to benchmark 

> I would also vote "+1" for an ND version of this (growing only a single
> dimension).

Yes, I think that is a good idea, and would certainly be useful for a 
common case -- growing a table of data, perhaps when reading a file, etc.

>  Keeping 2x for each of n dimensions, while conceivable, would
> be 2**n extra memory, and hence probably too costly.

That, and the fact that you'd have  to move a bunch of memory around as 
it grew -- if you only grow the first dimension (for C order, anyway), 
you can just tack stuff on the end (which usually necessitates a copy 
anyway, but it still seems easier.

thanks for the feedback,


Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception


More information about the NumPy-Discussion mailing list