multidimensional array of objects in scipy core
Robert Kern
robert.kern at gmail.com
Mon Jan 2 20:39:16 EST 2006
Stormslayer wrote:
> 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
mailing list