multidimensional array of objects in scipy core
robert.kern at gmail.com
Tue Jan 3 02:39:16 CET 2006
> Folks: How do you create a multidimesional array of objects w/ the size
> of the array entered at runtime? So basically, for an arbitrary class,
> create an array and then *.resize it to be of size NXM, and then
> populate the elements of the objects.
First, asking on the scipy mailing list will get you a better response.
Second, scipy_core does allow arrays of arbitrary Python objects, but
it doesn't do any kind of type-checking for those arrays. It is up to
you to populate the array with the kind of objects that you want.
arr = empty((N, M), object)
arr[i, j] = MyClass(i, j)
should work (can't check at the moment, though).
Please note that object arrays have always been tricky since Numeric,
so if you encounter strange behaviour, we would appreciate a report on
the scipy mailing list.
More information about the Python-list