[SciPy-user] unique, sort, sortrows

David M. Kaplan David.Kaplan@ird...
Mon Jul 28 09:56:00 CDT 2008


>From Alan Isaac:

Well, yes.  Note::

     >>> x = 1,2,3
     >>> type(x)
     <type 'tuple'>

In Python it is the commas, not the paretheses,
that is determining the tuple type.


Good point.  In any case, this is a workable problem.  Adding a comma
after the last argument to mgrid[] assures that it behaves "as
expected" (e.g. mgrid[(1,2),]).

Attached is a newer much cleaner version of my replacement for
index_tricks.py.  I did some optimisation and it looks like this new
version beats the old on similar operations for large meshed matrices.
For single return arrays or small matrices it looses to the old version,
but only slightly.  As large matrices are probably the bottleneck, this
seems like a reasonable tradeoff.


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.py
Type: text/x-python
Size: 14286 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20080728/3a7742bc/attachment.py 

More information about the SciPy-user mailing list