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

Travis E. Oliphant oliphant at enthought.com
Mon Jan 7 16:01:45 EST 2008


Andrew Straw wrote:
> Travis E. Oliphant wrote:
>   
>> 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.
>>
>>     
>
> Thanks. How is the array reference kept alive? Maybe that's Mike's issue?
>   
Hmm... I thought that I thought through this one.  But, as I look at the 
code now, I don't think it is kept alive.  I suspect that is the problem.

-Travis

> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>   




More information about the NumPy-Discussion mailing list