[Numpy-discussion] flat indexing of object arrays

Matthew Brett matthew.brett at gmail.com
Thu Oct 5 16:30:16 CDT 2006


Hi,

On 10/5/06, Martin Wiechert <martin.wiechert at gmx.de> wrote:
> 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:

I've also been having trouble with flat on object arrays.

Is this intended?

In [1]: from numpy import *

In [2]: a = arange(2)

In [3]: a[1]
Out[3]: 1

In [4]: a.flat[1]
Out[4]: 1

In [5]: b = array([a], dtype=object)

In [6]: b[1]
---------------------------------------------------------------------------
exceptions.IndexError                                Traceback (most
recent call last)

/home/mb312/devel_trees/scipy/Lib/io/<ipython console>

IndexError: index out of bounds

In [7]: b.flat[1]
Out[7]: 1

Best,

Matthew




More information about the Numpy-discussion mailing list