How to emulate matrix element access like 'a[i,j]'?

Blair Hall b.hall at irl.cri.nz
Sun Nov 24 22:20:57 EST 2002


I have a class with a private matrix member (a Numeric.array)
and I'd like to allow clients to access matrix members through
suitable functions.

How can I create classes of object that supports the
access style:
    aMatrix[ row_index, col_index ]

It seems that __setitem__ and __getitem__ are not the right way to go.






More information about the Python-list mailing list