[Numpy-discussion] DataArray fixes

Lluís xscript@gmx....
Mon Oct 18 09:58:18 CDT 2010


Fernando Perez writes:

> On Wed, Oct 13, 2010 at 6:02 AM, Lluís <xscript@gmx.net> wrote:
>> I thought that datarray module would be inside numpy, so the
>> construction interface would be:
>>      numpy.datarray.array(...)
>>        User-friendly constructor with "inlined" contents.
>>      numpy.datarray.DataArray(...)
>>        Low-level contructor with uninitialized contents.

> I see your point, but I think overriding the 'array' name is not very
> safe in the long run.  Imagine reading a fragment of code using
> datarrays, you'd have to constantly look at the top for the import
> line, to see 'is this the 'array' from datarray or the numpy one?  And
> if you need to use both (likely a very common scenario) you'd be
> aliasing one of them all the time.  So let's avoid the naming
> collision from the beginning, rather than having everyone work around
> it always.

Ah well, I don't usually import routines into my namespace, but full
packages to avoid collisions and ease understanding of the source :)

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?

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.

Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth


More information about the NumPy-Discussion mailing list