[Numpy-discussion] Numarray feature request: supporting the buffer interface

Todd Miller jmiller at stsci.edu
Fri Jan 7 07:10:22 CST 2005


On Fri, 2005-01-07 at 09:54, Robert Kern wrote:
> Todd Miller wrote:
> 
> > numarray has a concept of "misbehaved arrays", i.e.  arrays in the
> > binary format of another platform and therefore byte-swapped,  or arrays
> > spread across records and therefore possibly noncontiguous or
> > misaligned.  I think these buffers are likely unusable so providing
> > access to them is a mistake.  Misbehaved arrays probably don't arise in
> > the work of most users,  but they are a possibility that has to be
> > accounted for.
> > 
> > For cases of misbehaved arrays,  I think raising a ValueError exception
> > is necessary.  How does that sound?
> 
> For the byteswapped case, could I still get a buffer object around the 
> raw data by using _data? If so, I vote +1.

Sure.  Alternately,  you could make a copy of the array which will
automatically be well behaved and therefore usable in C.

Regards,
Todd







More information about the Numpy-discussion mailing list