Re: [Numpy-discussion] flat indexing of object arrays

2006-10-05 Thread Matthew Brett
Hi,

On 10/5/06, Martin Wiechert [EMAIL PROTECTED] 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.IndexErrorTraceback (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

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] flat indexing of object arrays

2006-10-05 Thread Travis Oliphant
Martin Wiechert 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:

  

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)?

  

You are probably right.This should be changed.

-Travis


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion