[Numpy-discussion] What protocol to use now?

Robert Kern robert.kern@gmail....
Tue Dec 8 14:23:36 CST 2009


On Tue, Dec 8, 2009 at 12:34, Christopher Barker <Chris.Barker@noaa.gov> wrote:
> Hi folks,
>
> There was just a question on the wxPython list about how to optimize
> some drawing of data in numpy arrays. Currently, wxPython uses
> PySequenceGetItem to iterate through an array, so you can imagine there
> is a fair bit of overhead in that.
>
> But what to use?
>
> We don't want to require numpy, so using the numpy API directly is out.
>
> Using the buffer interface makes it too hard to catch user errors.
>
> The array interface was made for this sort of thing, but is deprecated:
>
> http://docs.scipy.org/doc/numpy/reference/arrays.interface.html
>
> Is the new PEP 3118 protocol now (as of version 1.4) supported by numpy,
> at least for export? At the moment, a one-way street is OK for this
> application.

I think the wording is overly strong. I don't think that we actually
decided to deprecate the interface. PEP 3118 is not yet implemented by
numpy, and the PEP 3118 API won't be available to Python's <2.6
(Cython's workarounds notwithstanding).

Pauli, did we discuss this before you wrote that warning and I'm just
not remembering it?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list