Dan Goodman wrote: > (because I want to construct the 1D arrays X, Y above from values picked > from a variety of possible data structures, including dense and sparse > 2D arrays, but in such a way that the code that uses these values > doesn't have to know where the values came from in these data > structures).
I wonder if you could define a new datatype (or set of datatypes) for numpy: pointer_to_double, etc. What I'm wondering is how you would construct an array of such types in python, though I suppose you could do something like: a = np.array(data, dtype=np.float) pa = np.empty(size, dytpe=np.p_float) pa[i] = a[i] and have it do "the right thing". You might also be able to grab pointers with ctypes or cython. > code which involves scheduling events in the future (simple events like > add a value to another value), but the library is supposed to be easily > extensible for people who don't know C so I want to make it as easy to > use as possible. > > Well, that's a slightly underdefined problem, basically I just have a > vague idea that something like the above would be useful to me and I'm > looking for any ideas that might seem relevant. Overall, if you want easy to use, and not a lot of segfalts, I suspect you are better off getting away from pointers in user code, and instead creating objects for your users to manipulate that grab copies of data from where they need it, and update the original data when it changes. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion