Hi all, I've coding an ArrayList object based on a regular numpy array. This objects allows to dynamically append/insert/delete/access items. I found it quite convenient since it allows to manipulate an array as if it was a list with elements of different sizes but with same underlying type (=array dtype).
# Creation from a nested list L = ArrayList([ [0], [1,2], [3,4,5], [6,7,8,9] ]) # Creation from an array + common item size L = ArrayList(np.ones(1000), 3) # Empty list L = ArrayList(dype=int) # Creation from an array + individual item sizes L = ArrayList(np.ones(10), 1+np.arange(4)) # Access to elements: print L[0], L[1], L[2], L[3] [0] [1 2] [3 4 5] [6 7 8 9] # Operations on elements L[:2] += 1 print L.data [1 2 3 3 4 5 6 7 8 9] Source code is available from: https://github.com/rougier/array-list I wonder is there is any interest in having such object within core numpy (np.list ?) ? Nicolas _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion