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

David M. Kaplan David.Kaplan@ird...
Mon Sep 15 02:56:53 CDT 2008


Ahh, yes, I forgot about that problem - if you have mixed types forcing
to an array doesn't make much sense and can have undesired results such
as forcing numbers to strings unless you explicitly force to an object
array.  As this would be undesirable in most non-mixed cases, you would
need to type check everything....

This ability to mesh non-numerical arrays has lots of uses and I think
the change to a list will be transparent for most users who never use
the packed array.  Also, this makes ogrid and mgrid return consistent
type objects.  Therefore, I think it is worth the API change.


On Sun, 2008-09-14 at 12:00 -0500, numpy-discussion-request@scipy.org
> Message: 2
> Date: Sat, 13 Sep 2008 14:03:48 -0500
> From: "Travis E. Oliphant" <oliphant@enthought.com>
> Subject: Re: [Numpy-discussion] patch for new mgrid / ogrid
>         functionality
> To: Discussion of Numerical Python <numpy-discussion@scipy.org>
> Message-ID: <48CC0E94.60702@enthought.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> St?fan van der Walt wrote:
> > 2008/9/13 Travis E. Oliphant <oliphant@enthought.com>:
> >   
> >> 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.
> >>     
> >
> > The example he gave illustrated having a mixed bag of types in one
> > grid.  You can do that with two arrays, but not one, unless you use
> > object-arrays for everything.  Maybe that makes sense.
> >
> >   
> I don't see why you have to use object-arrays for everything, but 
> obviously you would for the mixed types.
> -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