[Numpy-discussion] filling an alice of array of object with a reference to an object that has a __getitem__ method
"David Köpfer"
dkoepfer@gmx...
Fri Jan 6 06:15:22 CST 2012
Dear numpy community,
I'm trying to create an array of type object.
A = empty(9, dtype=object)
A[ array(0,1,2) ] = MyObject(1)
A[ array(3,4,5) ] = MyObject(2)
A[ array(6,7,8) ] = MyObject(3)
This has worked well until MyObject has gotten an __getitem__ method. Now python (as it is usually supposed to) assigns A[0] to MyObject(1)[0], [1] to MyObject(1)[1] and so on.
Is there any way to just get a reference of the instance of MyObject into every entry of the array slice?
Thank you for any help on this problem
David
More information about the NumPy-Discussion
mailing list