On Tuesday 10 May 2011 05:24:16 Terry Reedy wrote: > On 5/9/2011 4:25 AM, Antonio CHESSA wrote: > > apple = > > [["a","b","c"],[1,2,3,4,5,6],["antony","max","sandra","seb > > astian"]] > > for j in range (len(apple[i])): > > print apple[i][j] > > While this illustrate double indexing, it can be simplified > to > > for top in apple: > print(top) > for inner in top: > print(inner) > > and give the same output. Indexing is only needed for random > access and for changing a list in place.
The method of double indexing in the manner apple[i][j] or a[i][j] for the (i, j) -th element of multi-dimensional array is well known and widely used. But how to enable the "standard" matrix notation a[i, j] in Python 3.2 in the manner of numpy (and other matrix packages)? Is it subclassing of "special methods" __getitem__() and/or __setitem__() and if so how? OldAl. -- Algis http://akabaila.pcug.org.au/StructuralAnalysis.pdf
-- http://mail.python.org/mailman/listinfo/python-list