On Aug 30, 2009, at 11:40 PM, Mattia Ziulu wrote:

> The point was, I didn't actually know how to properly implement  
> __getitem__, I thought that I had to pass it as arguments the  
> indexes (note the plural) of the element I wanted. I made some  
> progress passing it a tuple, calling that is foo[1,2], and this  
> worked. A coworker of mine (my superior, actually) then told me  
> that I could implement __getitem__ to work recursively, and right  
> now that's how i have it working. Only caveat, it doesn't return a  
> row if I ask for foo[n], but that's probably something I can come  
> up with some thought, as Greg points out.

Yep, though there's really little benefit to doing it recursively  
(that's just how C does it because there's no notion of multi- 
dimensional arrays, just arrays of arrays) and it may have a  
performance penalty.

- Robert


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to