[Numpy-discussion] why numarray.inputarray?

Todd Miller jmiller at stsci.edu
Tue Feb 10 10:58:02 EST 2004


On Tue, 2004-02-10 at 09:31, Colin J. Williams wrote:
> Tim Hochberg wrote:
> 
> >
> > I just noticed that the name asarray is considered obsolete and is to 
> > be replaced with inputarray. Why is that? The name asarray has a 
> > pretty clear connection with it's behaviour (return it's argument as 
> > an array), while I can come up with no such connection for inputarray. 
> > The best I can come up with is that it's often used on the inputs of 
> > functions to coerce them to arrays, but that seems a pretty tenuous 
> > connection. Is there a better reason? Am I just being obtuse?
> >
> > -tim
> 
> I agree that the term asarray better describes the functionality. 
> 
> One possible use would be to convert an instance of a sub-class of 
> NumArray into an instance of the class NumArray.  However, it doesn't do 
> that.
> 
> It would help if there were a clearer distinction between the functions 
> array and inputarray.  The former would appear to cast a wider net and, 
> among other things, include files.

This is a mess, I have to agree.  The most important distinction is that
array() makes a copy of an array by default, while
inputarray()/asarray() does not.

> I wonder whether there is a need for both array and input array, 
> wouldn't it be best to focus on the function with the more general utility?
Based on your input, and Tim Hochberg's earlier comments,  I think we
should:

1. Clean up the array function by ditching the buffer/sequence keyword
deprecation code.  buffer has been deprecated long enough.

2. Redefine asarray() as calling array() with copy=1.  Tim's right. 
It's a better name than inputarray() and we want it for backward
compatibility anyway.

3. Redefine inputarray() as a non-recommended synonym for asarray(). 
I'd say deprecate it,  but that's a PITA for anyone already using it.

4. Change the manual to document asarray() as primary and document
inputarray() as a non-recommended synonym.

Comments?

Todd

> 
> Colin W.
> 
> >
> >
> >
> > -------------------------------------------------------
> > The SF.Net email is sponsored by EclipseCon 2004
> > Premiere Conference on Open Tools Development and Integration
> > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> > http://www.eclipsecon.org/osdn
> > _______________________________________________
> > Numpy-discussion mailing list
> > Numpy-discussion at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/numpy-discussion
> >
> 
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
-- 
Todd Miller <jmiller at stsci.edu>





More information about the NumPy-Discussion mailing list