[Numpy-discussion] Latest Array-Interface PEP

Christopher Barker Chris.Barker at noaa.gov
Thu Jan 4 16:30:28 EST 2007


Travis,

First, thanks for doing this -- Python really needs it!
 >  While this approach
>     works, it requires attribute lookups which can be expensive when
>     sharing many small arrays.  

Ah, I do like reducing that overhead -- I know I use arrays a lot for 
small data sets too, so that overhead can be significant.

I'm not well qualified to review the tech details, but to make sure I 
have this right:

>     static PyObject* bf_getarrayview (PyObject *obj)
> 
>     This function must return a new reference to a PyArrViewObject
>     which contains the details of the array information exposed by the
>     object.  If failure occurs, then NULL is returned and an exception 
>     set.  

So If I have some C code that wants to use any array passed in, I can 
just call:

bf_getarrayview (obj)

and if it doesn't return NULL, I have a valid array that I can query to 
see if it fits what I'm expecting.

Have I got that right?

If so, this would be great.

By the way,, how compatible is this with the existing buffer protocol?

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list