[SciPy-user] 'object_arrtype' problem

Travis Oliphant oliphant.travis at ieee.org
Sat Dec 10 01:24:33 CST 2005


Ryan Krauss wrote:

>One thing I don't like about Numeric returning the object is that
>things get a little messy when you aren't sure if you have an array or
>not.  I find myself calling atleast_1d a lot or writing tests using
>"if shape(obtject)" which returns an empty tuple for scalars.  I guess
>my thoughts are slightly twisted by everything being an array in
>Matlab.  I want to test if len==1, then it must be a scalar.  I guess
>I would be happiest with clean scalar tests and objects that worked
>well when iterating or indexing from an object array.
>  
>

Yes, this is why we went with the array scalars in the first place to 
avoid some of these problems.  I improved the object array-scalars a 
bit, so that they pass attribute lookups on to the wrapped object.  This 
will fix the immediate problem you encountered, and it seems like an 
obvious thing to do.

-Travis




More information about the SciPy-user mailing list