Exposing buffer interface for non-extension types?

Ken Watford kwatford+python at gmail.com
Tue Jul 20 18:09:22 EDT 2010


Is there any way to expose the PEP 3118 buffer interface for objects
that aren't extension types?

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.

The NumPy array interface works fine for now (especially since NumPy
is the only thing I need to consume these objects), but the
documentation claims that it's being deprecated in favor of PEP 3118,
so I thought it might be relevant to bring this up.



More information about the Python-list mailing list