[Numpy-discussion] iterate over multiple arrays
David Froger
david.froger at gmail.com
Sat Oct 1 12:21:43 EDT 2011
Thanks everybody for the different solutions proposed, I really appreciate.
What about this solution? So simple that I didn't think to it...
import numpy as np
from numpy import *
def f(arr):
return arr*2
a = array( [1,1,1] )
b = array( [2,2,2] )
c = array( [3,3,3] )
d = array( [4,4,4] )
for x in (a,b,c,d):
x[:] = x[:]*2
#instead of: x = x*2
print a
print b
print c
print d
--
More information about the NumPy-Discussion
mailing list