[Python-Dev] PEP 296 - The Buffer Problem

Todd Miller jmiller@stsci.edu
Tue, 23 Jul 2002 14:47:02 -0400


Scott Gilbert wrote:

>--- 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.
>
Letting the inner-thing be a mmap would enable slices of a mmap as views 
as opposed to strings.  We'd certainly like this for numarray, 
especially if it meant pickling efficiency for mmap based arrays.

>
>
>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
>
>_______________________________________________
>Python-Dev mailing list
>Python-Dev@python.org
>http://mail.python.org/mailman/listinfo/python-dev
>


-- 
Todd Miller 			jmiller@stsci.edu
STSCI / SSG			(410) 338 4576