[Numpy-discussion] Indexing API

Travis Oliphant travis@continuum...
Thu Jul 19 08:53:35 CDT 2012

On Jul 19, 2012, at 3:50 AM, Nathaniel Smith wrote:

> So the underlying problem with the controversial inplace_increment
> PR[1] is that currently, there's actually nothing in the public numpy
> API that exposes the workings of numpy indexing. The only thing you
> can do with a numpy index is call ndarray.__getattr__ or __setattr__.
> This is a pretty obvious gap, given how fundamental an operation
> indexing is in numpy (and how difficult to emulate). So how can we
> expose something that fixes it? Make PyArrayMapIterObject part of the
> public API? Something else?

I think you meant ndarray.__getitem__ and ndarray.__setitem__

As I mentioned in the comments, the original intention was to make PyArrayMapIterObject part of the public API.   However, I was not able to make it work in the way I had intended back then. 

Exposing the MapIterObject is a good idea (but it would have to be exposed already bound to an array) --- i.e. you create a new API that binds to a particular array and then expose the PyArray_MapIterNext, etc. functions. 

Perhaps something like:   PyArray_MapIterArray


More information about the NumPy-Discussion mailing list