[Numpy-discussion] flat indexing of object arrays

Martin Wiechert martin.wiechert at gmx.de
Thu Oct 5 15:09:03 CDT 2006


Hi list,

when I try to assign a sequence as an element of an object array via flat 
indexing only the first element of the sequence is assigned:

>>> import numpy
>>> numpy.version.version
'1.0rc1.dev3171'
>>> from numpy import *
>>> a = ndarray ((2,2), object)
>>> a.flat [2] = (1, 2, 3)
>>> a.flat [2]
1
>>> a
array([[None, None],
       [1, None]], dtype=object)

Is this a feature? Wouldn't a naive user like me expect
a.flat [2] == (1, 2, 3)?

Thanks in advance,
Martin Wiechert




More information about the Numpy-discussion mailing list