[Numpy-discussion] Should the fields in void scalars be available?

Travis E. Oliphant oliphant@enthought....
Fri Jun 27 17:13:44 CDT 2008

Robert Kern wrote:
> The only inconsistency I can see here is that x.item() gives a tuple
> rather than a scalar record. A scalar record does have field access,
> but the tuple doesn't.
> In [28]: x.item()['a']
.item() always returns a standard Python type.  So, this is expected 

If you want to index a 0-d array to get the array scalar do

x[()] or x[...]


More information about the Numpy-discussion mailing list