[Numpy-discussion] feedback request: proposal to add masks to the core ndarray

Gael Varoquaux gael.varoquaux@normalesup....
Thu Jun 23 16:48:50 CDT 2011

On Thu, Jun 23, 2011 at 03:53:31PM -0500, Mark Wiebe wrote:
>    concluded that adding masks to the core ndarray appears is the best way to
>    deal with the problem in general.

It seems to me that this is going to make the numpy array a way more
complex object. Althought it is currently quite simple, that object has
already a hard time getting acceptance beyond the scientific community,
whereas it should really be used in many other places.

Right now, the numpy array can be seen as an extension of the C array,
basically a pointer, a data type, and a shape (and strides). This enables
easy sharing with libraries that have not been written with numpy in

The limitations of the subclassing approach that you mention do not seem
fundemental to me. For instance the impossibility to mix subclasses could
perhaps be solved using the Mixin Pattern. Ufuncs need work, but I have
the impression that your proposal is simply to solve the special case of
masked data in the ufunc by breaking the simple numpy array model.

By moving in the core a growing amount of functionality, it seems to me
that you are going to make it more and more complex while loosing its
genericity. Each new feature will need to go in the core and induce a
high cost. Making inheritance and unfuncs more generic seems to me like a
better investment.

My 2 cents,


PS: I am on the verge of conference travel, so I will not be able to
participate any further in the discussion.

More information about the NumPy-Discussion mailing list