[SciPy-user] unique, sort, sortrows

David M. Kaplan David.Kaplan at ird.fr
Mon Jul 28 10:56:00 EDT 2008


Hi,

>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.

Cheers,
David


-- 
**********************************
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
France

Phone: +33 (0)4 99 57 32 27
Fax: +33 (0)4 99 57 32 95
http://www.ur097.ird.fr/team/dkaplan/index.html
**********************************

-------------- next part --------------
A non-text attachment was scrubbed...
Name: index_tricks.py
Type: text/x-python
Size: 14286 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20080728/3a7742bc/attachment.py>


More information about the SciPy-User mailing list