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

Antoine Pitrou solipsis at pitrou.net
Sun Jan 15 16:26:37 CET 2012


On Sun, 15 Jan 2012 17:44:30 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> 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
> object).
> 
> 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
> provided?

Would make sense indeed.

Regards

Antoine.





More information about the Python-ideas mailing list