Trouble when overloading operator[ ]
david_ullrich at my-deja.com
david_ullrich at my-deja.com
Mon Jul 24 11:58:18 EDT 2000
In article <397BD3E7.38BF914F at my.signature>,
Greg Ewing <see at my.signature> wrote:
> You may know already, but I just thought I'd mention
> that you can use this trick to make the implementation
> of your 2-index __getitem__ function look nice:
>
> class MyClass:
> def __getitem__(self, (x,y)):
> ...
Thanks. Actually in the one situation where I've
actually used these however-many-indicies-it-is things
this wouldn't work because I sometimes pass only one
index. (M[row] is a row of a matrix, while M[row, col]
is an entry. (No, I never heard of NumPy...))
DU
> --
> Greg Ewing, Computer Science Dept, University of Canterbury,
> Christchurch, New Zealand
> To get my email address, please visit my web page:
> http://www.cosc.canterbury.ac.nz/~greg
>
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list