Sept. 12, 2011
6:52 a.m.
Hy everybody, I'm wondering what is the (best) way to apply the same function to multiple arrays. For example, in the following code: 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] ) a = f(a) b = f(b) c = f(c) d = f(d) I would like to replace : a = f(a) b = f(b) c = f(c) d = f(d) with something like that, but which really modify a,b,c and d: for x in [a,b,c,d]: x = f(x) So having something like a pointer on the arrays. Thanks for your help ! David --