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?
/Sheldon Gary Herron wrote: > Sheldon wrote: > > Hi, > > > > I have two arrays that are of the same dimension but having 3 different > > values: 255, 1 or 2. > > I would like to set all the positions in both arrays having 255 to be > > equal, i.e., where one array has 255, I set the same elements in the > > other array to 255 and visa versa. Does anyone know how to do this > > without using for loops? > > > > Sincerely, > > Sheldon > > > > > Whatever for? Have you got something against for loops? > > However... > > You could roll you own loop: > i=0 > while i < whatever: > # ... do something with i > i += 1 > > But what's the point? This does the same as a for loop but slower. > > If you don't want any kind of a loop (again, What's the point?) you > could write something recursive: > > def proc(i, ...): > # ... do something with i > if i < whatever: > proc(i+1, ...) > > But this would be even slower. > > Gary Herron -- http://mail.python.org/mailman/listinfo/python-list