[SciPy-dev] Nested arrays

Travis Oliphant oliphant.travis at ieee.org
Wed Jan 11 02:30:17 EST 2006


Sasha wrote:

>In Numeric nested arrays could be indexed using multiple subscripts:
>
>  
>
>>>>from Numeric import *
>>>>x = empty(2,'O')
>>>>x[0] = array([1,2])
>>>>x[1] = array([1,2,3])
>>>>x
>>>>        
>>>>
>array([[1 2] , [1 2 3] ],'O')
>  
>
>>>>x[1][2]
>>>>        
>>>>
>3
>
>This feature is lost in NumPy:
>
>  
>
>>>>x = empty(2, object)
>>>>x[0] = array([1,2])
>>>>x[1] = array([1,2,3])
>>>>x[1][2]
>>>>        
>>>>
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>TypeError: unsubscriptable object
>
>  
>

I've committed two changes

1) Now all object array-scalars look to the proxied object for it's 
mapping, sequence, and buffer behavior

2) An ndarray (or subclass) is never wrapped in an object array.   It 
already has the needed methods so why wrap it...

This will allow ragged arrays to be defined and used more easily I believe.

-Travis




More information about the SciPy-Dev mailing list