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

David M. Kaplan David.Kaplan@ird...
Fri Sep 19 10:49:08 CDT 2008

Hi all,

Attached is a newer version of my patch that adds new mgrid / ogrid
functionality for working with arrays in addition to slices.  In fact, I
have attached two versions of the patch: index_tricks.patch, that is
just the last version of the patch I sent, and index_tricks.new.patch,
that has been modified so that it is backward compatible.  In the last
version, mgrid calls where all arguments are slices will return an
array, otherwise it returns a list as ogrid does.  This is the only
reasonable way to have the new functionality and maintain backwards

My 2 cents - I personally think the version that always returns a list
will ultimately be more transparent and cause fewer problems than the
newer version.  In either case, the plan should be to eventually have it
always return a list as that is the only fully consistent option, the
question is just when that switch should be made and by who.  If it is
done at the next major release, someone else will have to remember to ax
the additional code and correct the documentation....

Other changes that would be nice: add a __call__ method, create an
instance called ndgrid for matlab compatibility, and have meshgrid be
reimplimented using an nd_grid instance.


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: index_tricks.new.patch
Type: text/x-patch
Size: 8848 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080919/bee57ab8/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: index_tricks.patch
Type: text/x-patch
Size: 8077 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080919/bee57ab8/attachment-0003.bin 

More information about the Numpy-discussion mailing list