[Python-Dev] Extended Buffer Interface/Protocol

Neil Hodgson nyamatongwe at gmail.com
Wed Mar 21 23:01:55 CET 2007


Travis Oliphant:

> 3) information about discontiguous memory segments
>
>
> Number 3 is where I could use feedback --- especially from PIL users and
> developers.   Strides are a common way to think about a possibly
> discontiguous chunk of memory (which appear in NumPy when you select a
> sub-region from a larger array). The strides vector tells you how many
> bytes to skip in each dimension to get to the next memory location for
> that dimension.

   I think one of the motivations for discontiguous segments was for
split buffers which are commonly used in text editors. A split buffer
has a gap in the middle where insertions and deletions can often occur
without moving much memory. When an insertion or deletion is required
elsewhere then the gap is first moved to that position. I have long
intended to implement a good split buffer extension for Python but the
best I have currently is an extension written using Boost.Python which
doesn't implement the buffer interface. Here is a description of split
buffers:

http://www.cs.cmu.edu/~wjh/papers/byte.html

   Neil


More information about the Python-Dev mailing list