[Numpy-discussion] Accessing rank-0 array value?
jmiller at stsci.edu
Mon Jun 7 06:12:08 CDT 2004
On Mon, 2004-06-07 at 05:27, Peter Verveer wrote:
> For instance:
> >>> float(b)
> or probably more appropriate since it retains the type:
> >>> b[()]
> Both not very intuitive, are there any better ways?
Not that I'm aware of. The root problem is that it is not possible to
At one point, it was possible to say b, but that feature was
intentionally removed after a fair amount of discussion.
> On 7 Jun 2004, at 11:17, Francesc Alted wrote:
> > Hi,
> > Perhaps this is a stupid question, but I did not found any easy way to
> > get
> > the python object value from a rank-0 numarray array. That is:
> >>>> from numarray import *
> >>>> b=array(2)
> >>>> b
> > array(2)
> >>>> b
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > IndexError: Too many indices
> > In C, that seem to be possible provided you use the call:
> > PyObject* PyArray_Return(PyArrayObject *apr)
> > Is there any way to do that in python?
> This SF.Net email is sponsored by the new InstallShield X.
> From Windows to Linux, servers to mobile, InstallShield X is the one
> installation-authoring solution that does it all. Learn more and
> evaluate today! http://www.installshield.com/Dev2Dev/0504
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
Todd Miller <jmiller at stsci.edu>
More information about the Numpy-discussion