[Python-Dev] Extended Buffer Interface/Protocol

Guido van Rossum guido at python.org
Wed Mar 21 23:40:06 CET 2007


On 3/21/07, Neil Hodgson <nyamatongwe at gmail.com> wrote:
> 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

But there's always a call to remove the gap (or move it to the end).

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list