[Numpy-discussion] how to create an array of objects that are sequences?

Chris Barker Chris.Barker at noaa.gov
Sat Jan 5 02:37:34 EST 2008


Travis E. Oliphant wrote:

> I like the depth option, and that could be used with the current 
> interface without too much difficulty, I think.
> 
> This question does come up quite often and should probably be addressed.

Yes, it has, but the depth option was discussed too, and while it might 
solve some problems, it would still be ambiguous:

What if your "objects" were nested sequences, and you wanted to partly 
flatten them -- which would you flatten? Maybe that's a weird enough 
case that the depth option would work most of the time, but I'm not 
sure. I think a "shape" option might cover this better.

It seems the case at hand is how to make a custom object that can tell 
numpy how it should be put into an object array -- that may be an even 
rarer use case, but it seems like a good idea to support it.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

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

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list