[Python-Dev] PEP 296 - The Buffer Problem

Scott Gilbert xscottg@yahoo.com
Tue, 23 Jul 2002 11:33:02 -0700 (PDT)


--- Thomas Heller <thomas.heller@ion-tof.com> wrote:
> > 
> > They do, but the referenced "inner-thing" needs it's own reference
> count to
> > know how many "bytes-views" are sharing it.  When a bytes-view gets
> cleaned
> > up, it decrefs the reference count of the inner-thing it is referring
> to,
> > and if the reference count goes to zero, the bytes-view calls the
> > destructor for the inner-thing.
> > 
> Hm, I thought the 'inner-thing' is a python object (with it's own
> refcount) itself. Isn't the 'inner-thing' the bytes object owning
> the allocated memory? And the 'outer-things' (the views) simply
> viewing slices of this memory?
> 

The outer-thing is definitely the "bytes object", since that's what people
will work with directly.  It has to be a true Python object in all its
glory.

The inner-thing _could_ be a Python object (and Guido suggested that maybe
it should be), but that's an implementation detail.  I don't know why
anyone would want to work with the inner-thing directly.  However, one good
use case and I'll be sold on the idea.

I'll definitely add some verbage to clarify this in the next revision.

Cheers,
    -Scott



__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com