Can't assign sequence to PyObject array

19 Apr
2001
19 Apr
'01
12:06 p.m.
Is there a standard workaround to allow you to assign a sequence to a a single cell in PyObject array?
from Numeric import *
# Create a 2*5 array a = array([range(5),range(5)], PyObject)
a[0,0] = 4 #OK - assigns an int to element 0,0 a[0,3] = {} #OK - assigns a dict
# but, trying to assign an array to element 1,4 # (or any sequence) a[1,4] = array(range(10), Float)
The last assignment causes, ValueError: array too large for destination error Doh!!
Presumably its trying to treat this as an assignment to a slice. Is this a bug? Clearly it shouldn't be treated as a slice assignment since a[1,4] can only refer to an atomic element in the (2D) array, not a sequence.
Cheers, Stuart
8271
Age (days ago)
8271
Last active (days ago)
0 comments
1 participants
participants (1)
-
Stuart I Reynolds