David Isaac wrote: > Thanks to both Roberto and George. > I had considered the recursive solution > but was worried about its efficiency. > I had not seen how to implement the numpy > solution, which looks pretty nice. > > Thanks! > Alan > > You could also use pyarray, which mimics numpy's indexing, but uses native python lists as the data store.
So... >>> from pyarray import ndlist >>> source = ndlist([[['r00','g00','b00'],['r01','g01','b01']],[['r10','g10','b10'],['r11','g11' ... ,'b11']]]) >>> source array([[[r00, g00, b00], [r01, g01, b01]], [[r10, g10, b10], [r11, g11, b11]]]) >>> source[...,0] # note elipsis means skip all but the last dimension array([[r00, r01], [r10, r11]]) >>> _.tolist() [['r00', 'r01'], ['r10', 'r11']] >>> pyarray (single pure-python module) can be downloaded from: http://svn.brownspencer.com/pyarray/trunk/ Regards Michael -- http://mail.python.org/mailman/listinfo/python-list