[Python-Dev] PEP: Extending the buffer protocol to share array information.
oliphant.travis at ieee.org
Thu Nov 2 01:46:48 CET 2006
Fredrik Lundh wrote:
> Chris Barker wrote:
>>While /F suggested we get off the PIL bandwagon
> I suggest we drop the obsession with pointers to memory areas that are
> supposed to have a specific format; modern data access API:s don't work
> that way for good reasons, so I don't see why Python should grow a
> standard based on that kind of model.
> the "right solution" for things like this is an *API* that lets you do
> things like:
> view = object.acquire_view(region, supported formats)
> ... access data in view ...
> and, for advanced users
> format = object.query_format(constraints)
So, if the extended buffer protocol were enhanced to enforce this kind
of viewing and release, then would you support it?
Basically, the extended buffer protocol would at the same time as
providing *more* information about the "view" require the implementer to
undertand the idea of "holding" and "releasing" the view.
Would this basically require the object supporting the extended buffer
protocol to keep some kind of list of who has views (or at least a
number indicating how many views there are)?
More information about the Python-Dev