Stefan Krah <ste...@bytereef.org> wrote:
> > Why would the object that bf_getbuffer() is being called on have to
> > be identical with the one that exports the buffer?
> 
> It doesn't have to be. This is now possible:
> 
> >>> from _testbuffer import *
> >>> exporter = b'123'
> >>> nd = ndarray(exporter)
> >>> m = memoryview(nd)
> >>> nd.obj
> b'123'
> >>> m.obj
> <ndarray object at 0x7fbef33677d8>

Stefan (Behnel), do you have an existing example object that does
what you described? If I understand correctly, in the above example
the ndarray would redirect the buffer request to 'exporter' and
set m.obj to 'exporter'.

It would be nice to know if people are actually using this.

The reason why this scheme was not chosen for a chain of memoryviews
was that 'exporter' (in theory) could implement a slideshow of buffers,
which means that in the face of redirecting requests m might not be
equal to nd.


Stefan Krah


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to