[Numpy-discussion] DataArray fixes

Fernando Perez fperez.net at gmail.com
Mon Oct 18 17:02:34 EDT 2010


On Mon, Oct 18, 2010 at 7:58 AM, Lluís <xscript at gmx.net> wrote:
> Ah well, I don't usually import routines into my namespace, but full
> packages to avoid collisions and ease understanding of the source :)

Good practice, though it's still (I think) best to avoid colliding
with very common names in case someone uses the direct import approach
(which is perfectly valid and idiomatic Python).

> In fact, I looked into 'numpy.ma' to try to follow the same scheme. It
> does indeed have a 'numpy.ma.array', while 'numpy.ma.masked_array' seems
> just to be an alias for 'numpy.ma.MaskedArray'.
>
> In any case, I think you had one naming suggestion... could you type it
> again? Was it 'numpy.datarray.data_array'? Or perhaps something shorter?

I lean towards hoping that numpy would expose at the top level the
various *array() functions for the different array types:

np.array() -> plain
np.masked_array()
np.data_array()
np.record_array()

That would make it easier for people to discover them, and would also
encourage uniformization (when possible) of interfaces, signatures,
etc.  In teaching, it would also be easier to have a little chart
explaining the various specializations the other types make over the
basic one, and I think it would be more newbie-friendly to have this
layout.

> In any case, I do see your concerns. I'll fix all pending
> requests... when I have time. It's crazy right now, so I won't be having
> much time for at least two weeks.

Thanks, no worries.  It's not like we're drowning in free time here :)

Cheers,

f



More information about the NumPy-Discussion mailing list