[Numpy-discussion] construction of object arrays

Neal Becker ndbecker2@gmail....
Wed Jun 30 12:56:01 CDT 2010

What are ways to construct object arrays?  I want an array of objects, each 
element default constructed of a particular object type.

Say my object is class A.  I want a multi-dimensional array, each element 
constructed as A().

Right now, I use np.empty ((a,b,c...), dtype=object)

and then iterate over each dimension, assigning elements:

array[a,b,c...] = A()

Any better suggestions?

More information about the NumPy-Discussion mailing list