Mmh, if I call foo[0,0], passing the indexes like a tuple that is, if I got it right, it works correctly. At this point though a properties is redundant, isn't it, since I already access the internal data via __getitem__, right? It could be useful for the "matrix-like" representation, though, which I'm not getting using my implementation __getitem__...gonna play with it a little bit more.
On Fri, Aug 28, 2009 at 5:43 PM, Robert Bradshaw < [email protected]> wrote: > > First, implement __getitem__ and __setitem__, so you can do foo[1,5] > = 17. Second, how about > > property data: > def __get__(self): > cdef int i,j > return [ [ data[i+self.columns*j ] for i in range > (self.columns) ] for j in range(self.rows) ] > > Which should be faster at least (though you're still doing a lot of > float -> Python object conversions. > > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev >
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
