array manipulation without for loops

Alex Martelli aleax at mac.com
Sun Jun 25 12:41:17 EDT 2006


Sheldon <shejo284 at gmail.com> wrote:

> Hi Gary,
> 
> I am really trying to cut the time down as I have 600+ arrays with
> dimensions (1215,1215) to compare and I do a lot more things with the
> arrays. If I understand you correctly, there is no way around a for
> loop?

In pure Python (w/o extension packages) there are no 2-D arrays; so
either you're using lists of lists (and I wonder how you fit even one of
them in memory, if they're 1215 by 1215, much less 600!) or you're
already using some extension (Numeric, numarray, numpy) and aren't
telling us which one.  If you're using pure Python add your extension of
choice, if you're using an extension already tell us which one, and in
each case there will be ways to perform your manipulation tasks faster
than Python-level for loops would afford.


Alex



More information about the Python-list mailing list