[Python-3000] PEP Draft: Enhancing the buffer protcol
Jim Jewett
jimjjewett at gmail.com
Thu Mar 1 15:28:58 CET 2007
On 2/27/07, Travis E. Oliphant <oliphant.travis at ieee.org> wrote:
> Rationale
(This was a good section; thank you.)
> 5. There is no shape information provided for the memory. But,
> several array-like Python types could make use of a standard
> way to describe the shape-interpretation of the memory
> (!wxPython, GTK, pyQT, CVXOPT, !PyVox, Audio and Video
> Libraries, ctypes, !NumPy, data-base interfaces, etc.)
Are the "!" characters meaningful?
> This view object should be used in the other API calls and
> does not need to be decref'd. It should be "released" if the
> interface exporter provides the bf_releasebuffer function.
Pity you can't use decref instead of release ... could the description
object be treated as a real object, and decrefed to indicate release?
(Or are there lots of tiny buffers with identical large descriptions?)
> Additions to the struct string-syntax
>
> The struct string-syntax is missing some characters to fully
> implement data-format descriptions already available elsewhere (in
> ctypes and NumPy for example). Here are the proposed additions:
>
> Character Description
> ==================================
> '1' bit (number before states how many bits)
How do you distinguish the "1" for bit from a trailing 1 in a number?
It sounds like
"21" means 2 bits
"2g" means 2 long doubles
"21g" means either 2 bits and a long double, or 21 long doubles.
> Code should also be able to request contiguous memory if needed and
> objects exporting the buffer interface should be able to handle
> that either by raising an error
Do you want to specify the error?
-jJ
More information about the Python-3000
mailing list