[Numpy-discussion] Draft PEP for the new buffer interface to be in Python 3000

Charles R Harris charlesr.harris at gmail.com
Tue Feb 27 21:55:16 EST 2007


On 2/27/07, Travis Oliphant <oliphant at ee.byu.edu> wrote:
>
> PEP: <unassigned>
> Title: Revising the buffer protocol
> Version: $Revision: $
> Last-Modified: $Date:  $
> Author: Travis Oliphant <oliphant at ee.byu.edu>
> Status: Draft
> Type: Standards Track
> Created: 28-Aug-2006
> Python-Version: 3000


<snip>

>
> 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)
>    '?'               platform _Bool type
>    'g'               long double
>    'F'               complex float
>    'D'               complex double
>    'G'               complex long double
>    'c'               ucs-1 (latin-1) encoding
>    'u'               ucs-2
>    'w'               ucs-4
>    'O'               pointer to Python Object
>    'T{}'             structure (detailed layout inside {})
>    '(k1,k2,...,kn)'  multi-dimensional array of whatever follows
>    ':name:'          optional name of the preceeding element
>    '&'               specific pointer (prefix before another charater)
>    'X{}'             pointer to a function (optional function
>                                              signature inside {})


I think it might be good to have something for the quad and half precision
floats that will be coming along in the next IEEE754  specification. Quad
precision isn't used that much, but when you need it, it is useful. Half
precision (16 bits) is used in some GPU's and I have seen it used for such
things as recording side looking radar returns.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070227/4ec9a929/attachment.html>


More information about the NumPy-Discussion mailing list