[Python-ideas] Special method to delegate PEP 3118 buffer access to another object?

Nick Coghlan ncoghlan at gmail.com
Sun Jan 15 08:44:30 CET 2012

I'm still working on fixing CPython's operand precedence bug for pure
sequence types implemented in C [1], and, while trying to test
bytearray, came across the problem that there doesn't appear to be a
way to write a class in pure Python that redirects the PEP 3118 buffer
access slots to another object (e.g. a memoryview instance or a bytes

Did I miss something? And, if not, would it make sense to have the
buffer retrieval operations look for a __buffer__ method in the type
dictionary as a last resort if the relevant C level slots aren't


[1] http://bugs.python.org/issue11477

Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list