[SciPy-user] NumPy arrays of Python objects (it was Re: How to start with SciPy and NumPy)

Pierre GM pgmdevlist@gmail....
Mon Jan 26 02:02:17 CST 2009

Without a more specific example, it might be quite difficult for us to  
help you.
Would your 'value' property be of the same type for all the objects of  
your sequence ? If yes, then you could define a class where 'value'  
would be a ndarray. Other properties would then be other arrays, and  
so forth.
But I probably speak out of place.

On Jan 26, 2009, at 2:53 AM, Vicent wrote:

> Hello again.
> I have a doubt, related with all what was talked in the last posts  
> of the previous thread.
> I've managed to build a NumPy array whose elements (scalars?) are  
> objects from a class. That class was defined by me previously.
> Each object contains several properties. For example, they have the  
> property "value".
> For each object, the property "value" can contain many different  
> things, for example, an integer value, a boolean value or a "float".  
> SO, I think it wouldn't be possible to replace that "object"/class  
> with a NumPy data-type or "struct", in case I wanted.
> My question: is that a problem? I mean, is that NumPy array going to  
> be "slow" to search, and so on, because its elements are not  
> "optimized" NumPy types?? Maybe this question has no sense, but,  
> actually, I would like to know if there is any kind of problem with  
> that kind of "mixed structure": using NumPy arrays of developer- 
> defined (non-NumPy) objects.
> Thank you in advance!
> --
> Vicent
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-user mailing list