On Tue, Jul 20, 2010 at 6:58 PM, Stefan Behnel <stefan...@behnel.de> wrote: > Ken Watford, 21.07.2010 00:09: >> >> Is there any way to expose the PEP 3118 buffer interface for objects >> that aren't extension types? > > Given that it's a pure C-level interface, I don't think there would be much > use for that.
Perhaps, but *why* is it only a pure C-level interface? It's based on/inspired by the array interface, which was not a pure C-level interface. Did they simply neglect to provide the functionality due to lack of obvious use cases, or did they consciously decide to drop that functionality? >> Currently, I can expose the NumPy array interface (using either >> __array_interface__ or __array_struct__) for any class, extension or >> otherwise. But I can't find any reference to python-side interfacing >> for PEP 3118. SWIG makes an extension module for your wrapped code, >> but not extension *types*, so the classes it produces are pure-python >> with methods added in from the extension module. > > Try using Cython instead, it has native support for the buffer protocol. I've used Cython before, and I generally like it. But its purpose is slightly different than SWIG's, and does not particularly meet my current project's needs. -- http://mail.python.org/mailman/listinfo/python-list