# Buffer Protocol with PEP3118 struct string syntax

**URL:** <https://discuss.python.org/t/buffer-protocol-with-pep3118-struct-string-syntax/77083>\
**Category:** Core Development\
**Created:** [January 14, 2025, 10:26am UTC](https://discuss.python.org/t/buffer-protocol-with-pep3118-struct-string-syntax/77083 "2025-01-14T10:26:49Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ngoldbaum](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ngoldbaum/32/12276_2.png) [@ngoldbaum](https://discuss.python.org/u/ngoldbaum)\
**Post date:** [January 14, 2025, 9:07pm UTC](https://discuss.python.org/t/buffer-protocol-with-pep3118-struct-string-syntax/77083/3 "2025-01-14T21:07:01Z")

</div>

> [@encukou](#):
>
> Since you posed in Core Development: Yes, I’m willing to mentor someone who’d want to put in the work of researching and implemening something that would suit `struct`, `ctypes` and `numpy` (and others?).

If there’s interest in improving the buffer protocol implementation in Python, something that would make this much more attractive from the NumPy side is to make it easier to work with arbitrary data types. See [this thread](https://discuss.python.org/t/buffer-protocol-and-arbitrary-data-types/26256) for the last time NumPy developers broached this.

While the Arrow C Data interface would definitely help in many use cases, it’s not quite what NumPy needs (e.g. \>1D data, strides, etc), and the buffer protocol has the nice advantage that it’s already used throughout the ecosystem.

It would also be nice to fix the [thread safety issues inherent in the design of the buffer protocol](https://alexgaynor.net/2022/oct/23/buffers-on-the-edge/). Producers of buffers ought to have a way to do borrow checking on the buffer.

Sorry if this thread is actually unrelated to coming up with a sucessor to the buffer protocol. I just thought I’d throw it out there because it would unlock a lot of cool functionality in the future to allow zero-copy data sharing with arbitrary data layouts.

---

_[View the full topic](https://discuss.python.org/t/buffer-protocol-with-pep3118-struct-string-syntax/77083)._
