I'm also in the non-subclass array-like camp, and I'd love to just write vindex and oindex methods, then have:

def __getitem__(self, idx):
    return np.dispatch_getitem(self, idx)

Where "dispatch_getitem" does some basic argument checking and calls either vindex or oindex as appropriate.

Maybe that fits better as a mixin; I don't really mind either way.

On Tue, Sep 6, 2016 at 12:11 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:

On Tuesday, September 6, 2016, Stephan Hoyer <shoyer@gmail.com> wrote:
On Mon, Sep 5, 2016 at 6:02 PM, Marten van Kerkwijk <m.h.vankerkwijk@gmail.com> wrote:
p.s. Just to be clear: personally, I think we should have neither
`__numpy_getitem__` nor a mixin; we should just get the quite
wonderful new indexing methods!


I don't maintain ndarray subclasses (I prefer composition), but I don't think it's too difficult to require implementing vindex and oindex properties from scratch.

Side note: I would prefer the more verbose "legacy_index" to "lindex". We really want to discourage this one, and two new abbreviations are bad enough.

Very much agreed. 

NumPy-Discussion mailing list