[Numpy-discussion] patch for new mgrid / ogrid functionality

David M. Kaplan David.Kaplan@ird...
Sun Sep 14 02:49:11 CDT 2008


On Sat, 2008-09-13 at 12:00 -0500, numpy-discussion-request@scipy.org
> St?fan van der Walt wrote:
> > Hey all,
> >
> > David Kaplan implemented a generalised ogrid/mgrid, and would like
> to
> > have some feedback.  See
> >
> >
> http://projects.scipy.org/pipermail/numpy-discussion/2008-August/036691.html
> >
> > for his original email and attachment.
> >
> > If no one objects to such functionality, I shall review the patch
> and apply it.
> >   
> Generally, it is O.K. except that he changes the output from a numpy 
> array to a list of numpy arrays.  This is a small change, but it is
> an 
> API change.   I'm not sure why he found it necessary to do that, but
> it 
> would be easier to apply the patch if it didn't change the API.

My reason for returning a list is that with the new functionality it was
more efficient to use a list (note that ogrid always returns a list).
It is easy to force the list to an array before returning (if not
sparse), but if I remember correctly that had a performance hit.  Also,
the vaste majority of users probably unpack the array immediately making
conversion to an array unnecessary.

I leave it up to you which is best.  I can add the line to convert to
array if desired.


> -Travis
David M. Kaplan
Charge de Recherche 1
Institut de Recherche pour le Developpement
Centre de Recherche Halieutique Mediterraneenne et Tropicale
av. Jean Monnet
B.P. 171
34203 Sete cedex

Phone: +33 (0)4 99 57 32 27
Fax: +33 (0)4 99 57 32 95

More information about the Numpy-discussion mailing list