[Python-Dev] A draft PEP for a new memory model

Guido van Rossum guido@python.org
Fri, 14 Sep 2001 11:33:53 -0400


Hi Paul,

Thanks for yor PEP.  After reading it, I'm still not quite sure what
the real problem is that you're trying to solve.  Your description
hints at practical problems with using the buffer or array objects for
managing large chunks of memory, but I'm not quite sure what kind of
application you have in mind.

Your diagram doesn't clarify things much -- it's too abstract, and can
be used for many different designs.  I guess I'm saying that I'm not
sure what's different about your model.

I also have a feeling that by looking at a slightly different
abstraction level you could get most of what you want with only
relatively small changes to some existing objects.  Rather than focus
on the differences between string/array/buffer/mmap, focus on their
similarities: they all support the sequence API.

The array module can be used to allocate heap memory.  The mmap module
can be used to allocate shared memory.  Could you write the
application you have in mind in such a way that it can work with
either kind of object?

You hint at a problem with array's repr().  What exactly is the
problem here?

Your complaints about the buffer object are misguided.  Pretend the
buffer object doesn't exist -- it is *not* intended as a memory
management tool.  (I guess the name is misleading, because we get this
confusion a lot.)

Maybe all you need to do is write your own object type that implements
your model.  How would it differ from the existing array and mmap
implementations?

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