[Numpy-discussion] Is __array_interface__ supposed to work on numpy scalars?

Travis E. Oliphant oliphant@enthought....
Mon Jan 7 14:06:38 CST 2008


Andrew Straw wrote:
> Hi,
>
> I'm forwarding a bug from PyOpenGL. The developer, Mike Fletcher, is
> having troubles accessing a numpy scalar with the __array_interface__.
> Is this supposed to work? Or should __array_interface__ trigger an
> AttributeError on a numpy scalar? Note that I haven't done any digging
> on this myself...
>   

Yes, the __array_interface__ approach works (but read-only).  In fact, 
what happens is that a 0-d array is created and you are given the 
information for it.

-Travis O.




More information about the Numpy-discussion mailing list