[Numpy-discussion] Latest Array-Interface PEP

Christopher Barker Chris.Barker at noaa.gov
Thu Jan 4 17:06:46 CST 2007

Travis Oliphant wrote:
>> bf_getarrayview (obj)
> Yes you could call this (but you would call it from the type object like 
> this
> obj->ob_type->tp_as_buffer->bf_getarrayview(obj)
> Or more likely (and I should add this to the C-API) you would call.
> PyArrayView_FromObject(obj)

yes, that's what I'm looking for -- please do add that to the C-API

>> By the way,, how compatible is this with the existing buffer protocol?
> It's basically orthogonal.  In other-words, if you defined the array 
> view protocol you would not need the buffer protocol at all.  But you 
> could easily define both.

OK, so if one of these were passed into something expecting the buffer 
protocol, then it wouldn't work, but you could make an object conform to 
both protocols at once -- like numpy does now, I suppose -- very nice.

Another question -- is this new approach in response to feedback from 
Guido and or other Python devs? This sure seems like a good way to go -- 
though it seems from the last discussion I followed at python-dev, most 
of the devs just didn't get how useful this would be!


Christopher Barker, Ph.D.

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