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

Robert Kern robert.kern@gmail....
Tue Sep 23 12:33:16 CDT 2008

On Tue, Sep 23, 2008 at 02:39, David Kaplan <David.Kaplan@ird.fr> wrote:
> Hi,
> I would note that there is nothing in the API breakage that prevents
> doing what Gael mentions.  The only change is that:
>> > X = mgrid[0:4, 0:4, 0:4]
> would be replaced with:
> X = asarray( mgrid[ 0:4, 0:4, 0:4 ] )
> On the other hand, not making this change makes for a strange and ugly
> implementation.
>> Agreed. Please don't change this behavior even through a deprecation.
> Long term it is bound to cause problems to have nd_grid return a list in
> 3 out of 4 use cases, but an array in other cases.  This function is
> already quite confusing for users because it uses indexing instead of a
> function call.  Adding this nuance might be great for the power user,
> but will confuse most.

The only time it would need to return a list is with the new
functionality. So expose the new functionality with a different object
instead of cramming it into an existing object with an incompatible

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the Numpy-discussion mailing list