Rationale behind the deprecation of __getslice__?

Fernando Perez fperez528 at yahoo.com
Thu Dec 9 21:41:00 EST 2004


Steven Bethard wrote:

> Presumably the numarray code has to do quite a bit of type checking to
> perform all these slicings right (and I didn't even show you what
> happens when you use another array as an "index").  I'm not necessarily

Yes, I know.  I haven't switched to numarray because of the small-array penalty
(which I can't pay in my code), but recently T. Oliphant added array-indexing
to Numeric in Scipy's port.  Very nifty.

> saying that all this type checking is a good thing, but because people
> will always find new things that they want to index by, adding
> __getxxx__ methods for each of the index types is probably not the right
> road to go down...

Ultimately it's true that since indexing objects for multidimensional arrays
will always come in packaged as a tuple, the __getitem__ method will simply
have to deal with a fair bit of analysis before getting to the meat of
actually returning a result.

Anyway, thanks for the discussion, it clarified a few points.

Regards,

f




More information about the Python-list mailing list