[SciPy-dev] 'O' type arrays and containers as values...

Travis Oliphant oliphant at ee.byu.edu
Fri Nov 4 17:12:22 EST 2005


Fernando Perez wrote:

>Buit I'd argue that if the LHS is of type 'O', even that should work, no? 
>Basically my way of looking at this is: type 'O' arrays hold opaque pointers 
>to arbitrary Python objects.  In a sense they are almost like a dictionary 
>with tuple keys, but with the usual semantics of scipy arrays.
>  
>
I just added the special-case check so that now single-item assignment 
works as expected
for object arrays.   It's in SVN.

It's still ambiguous as to what to do with initialization from container 
types.

For example,

array([[1,2,3],[3,4,5]],'O') produces an 2x3 array of integer objects.  
Or did you want a 1x2 array of list objects?

Not sure how to fix that one without a special-purpose object array 
creation function that fixes the shape.

-Travis




More information about the SciPy-Dev mailing list