[Numpy-discussion] indexing on uninitialized arrays

Sebastian Stark stark at tuebingen.mpg.de
Wed Oct 20 23:56:14 CDT 2004


In matlab I can do:

>> x = []

x =

     []

>> x(2) = 1.4

x =

         0    1.4000

>> x(2,4) = 2.9

x =

         0    1.4000         0         0
         0         0         0    2.9000


which means x expands as necessary depending on "how far" my indexing goes. 

Now I'm thinking about how to realize this with numarray. I could imagine to 
define a derived array type "SelfInflatingArray" which catches the IndexError 
exception and does the right thing then. Any better ideas?


-Sebastian

-- 
Sebastian Stark -- http://www.kyb.tuebingen.mpg.de/~stark
Max Planck Institute for Biological Cybernetics
Spemannstr. 38, 72076 Tuebingen
Phone: +49 7071 601 555 -- Fax: +49 7071 601 552




More information about the Numpy-discussion mailing list