[Python-Dev] Fw: Behavior of buffer()

Guido van Rossum guido@python.org
Mon, 15 Jul 2002 10:50:32 -0400


> >How do you use buffers?  

> We use buffers in numarray to store our array data.   We use readinto to 
> load array buffers efficiently from a file.    We operate on the buffer 
> data in-place.  Since numarrays are python classe instances, buffers 
> provide a place for the data to live.

AFAIK the buffer() function can only create read-only buffers.  How do
you create your buffers?  If you're just using the C buffer API,
that's not going away.

> >Do you stick to their C API?  
> >
> We use the C-API, and currently use the buffer object too.   Using the 
> buffer object has always seemed like a necessary evil, but having 
> reviewed numarray usage of buffer(), ditching it sounds good to me.

Good.

> >And from where do you get a buffer?  There are darned few types in Python

> We get ours from mmap and our own homegrown memory object.

Maybe instead of the buffer() function/type, there should be a way to
allocate raw memory?

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