If there are no objections, I'll file this ticket in the trac site:
Title:
Return type inconsistency in recarray
Description:
The sub-arrays of rank-0 recarrays are returned as scalars rather than
rank-0 ndarrays.
Example:
>>> import numpy as N
>>> dt = N.dtype([('x','f8'),('y','f8')])
>>>
El dl 19 de 03 del 2007 a les 15:59 -0400, en/na Matthew Koichi Grimes
va escriure:
> Francesc Altet wrote:
> > with a
> > rank-0 'recarr', 'recarr.x' should return a rank-0 array (for
> > consistency), but it doesn't:
> >
> > In [74]:recarr=numpy.rec.array((1.0, 0, 3), dtype)
> > In [75]:recarr.x
Francesc Altet wrote:
> with a
> rank-0 'recarr', 'recarr.x' should return a rank-0 array (for
> consistency), but it doesn't:
>
> In [74]:recarr=numpy.rec.array((1.0, 0, 3), dtype)
> In [75]:recarr.x
> Out[75]:1.0
> In [76]:type(recarr.x)
> Out[76]:
>
> While I find this inconsistent, I'm not sure
El ds 17 de 03 del 2007 a les 18:53 -0400, en/na Matthew Koichi Grimes
va escriure:
> I've found that if I have a record array of shape [] (i.e. a scalar
> recarray), I can't set its fields.
>
> >>> recarr
> recarray((0.0, 0.0, 0.0),
> dtype=[('x', ' >>> recarr.x[...] = 1.0
> TypeError: o
I've found that if I have a record array of shape [] (i.e. a scalar
recarray), I can't set its fields.
>>> recarr
recarray((0.0, 0.0, 0.0),
dtype=[('x', '>> recarr.x[...] = 1.0
TypeError: object does not support item assignment
In the above, recarr.x returned a float "0.0", then attempted